<?php
// PROOF OF CONCEPT ONLY NOT INTENDED TO BE USED.
//
// TINY_CHAT_ROOM_VIEWER: Version Public sauce
// DATE: 2-4-2011
// DEVELOPER: PHP - Heisenberg a.k.a Cancerous a.k.a Gellin && <gay>HTML</gay> - TheOneSage
// KNOWN AFFILIATES: www.GAMEHACKING.NET || www.dxtgaming.com || www.rule-de-game.com || www.uc-forum.com || www.delta-h.net
// GIVE CREDIT WERE ITS DO - DONT BE A n3WF4G
//
// PROOF OF CONCEPT ONLY NOT INTENDED TO BE USED.
require_once( "functions.php" );
//Start a interwebs session
session_start();
//The name of the document used for the form action methods
$v_DOCUMENT_NAME = "remote_viewer.php";
//Password
$v_PASSWORD = "hellodevs";
//SuM CSSCAUSE
//http://tinychat.com/public/css/global.css?v=2.0.0c
//http://gamehacking.net/other/TinyThing/Viewer/css/style.css
echo'<html>
<body>
<link rel="stylesheet" href="http://gamehacking.net/TinyThing/css/style.css" type="text/css" media="screen" />
<table align="center" cellspacing="5">
<tr>
<td colspan=2 align="center"> <font size="6">.:: TinyChat Creeper ::.</font></td>
</tr>
</table>';
// if the password button was clicked and the password is correct OR the user has a previous login session.
if(( $_POST['pass_submit'] == "login" && $_POST['pass'] == $v_PASSWORD ) || $_SESSION['loggedin'] == 1 )
{
$_SESSION['loggedin'] = 1;
if( isset( $_POST['room'] ) && $_POST['room'] != "" )
$v_ROOM = $_POST['room'];
else
$v_ROOM = '';
$v_IMAGE_SET = (int)$_POST['imageset'];
if( !is_int( $v_IMAGE_SET ) )
(int)$v_IMAGE_SET = 0;
if( (int)$v_IMAGE_SET < 0 || (int)$v_IMAGE_SET > 4 )
(int)$v_IMAGE_SET = 0;
//onfocus="javascript:{if(!this._haschanged){this.value=null};this._haschanged=true;}"
echo'<table align="center" cellspacing="5">
<form action=',$v_DOCUMENT_NAME,' method="post" name="view">
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr>
<td align="center">Room</td>
</tr>
<tr>
<td><input type="text" class="input" name="room" value="',$v_ROOM,'" /></td>
</tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr>
<td align="center">Image ( 0 - 4 )</td>
</tr>
<tr>
<td><input type="text" class="input" name="imageset" value="',$v_IMAGE_SET,'" /></td>
</tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr>
<td><input type="checkbox" name="showusername" value="showusername" />Show Usernames</td>
</tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr>
<td colspan=2 align="center"><input type="submit" class="button" name="view" value="go" /></td>
</tr>
</form>
</table>';
//If GO was pressed and their is data in both input box's
if( $_POST['view'] == "go" && isset( $_POST['room'] ) && isset( $_POST['imageset'] ) )
{
$v_PAGE = fopen( 'http://tinychat.com/api/hovercard.php?username='.$v_ROOM, 'r' );
$v_XML_PAGE = "http://tinychat.apigee.com/".$v_ROOM.".xml";
$v_IMAGE_DEFUALT = "http://upload.tinychat.com/i/";
$v_IMAGE_URL = $v_IMAGE_DEFUALT.$v_IMAGE_SET."/";
if( $v_PAGE )
{
$v_CONTENT = '';
$v_REPLACE = array( "width='20'", "height='20'", "width='50'", "height='50'" );
$v_REPLACE_TO = array( "width='160'", "height='120'", "width='200'", "height='200'" );
//Parse the html page and edit the image tags
while( $v_tLine = fread( $v_PAGE, 1024 ) )
{
//Parse the html that $v_PAGE outputs and change the size of the image to something visible.
$v_TEMP = str_replace( $v_REPLACE, $v_REPLACE_TO, $v_tLine );
$v_TEMP2 = str_replace( $v_IMAGE_DEFUALT, $v_IMAGE_URL, $v_TEMP );
$v_CONTENT .= $v_TEMP2;
}
//Image tag double check
//Ghetto rigged for safety
$v_FINAL = str_replace( $v_REPLACE, $v_REPLACE_TO, $v_CONTENT );
echo'<br /><br />';
echo $v_FINAL; //The only proper way to get this stupid preformed html to center was to close the table tag and open it after. i dont html
//Show Usernames
if( isset( $_POST['showusername'] ) )
{
echo'<br /><br />';
//Load the XML to a string
$XML_FILE_CONTENTS = file_get_contents( $v_XML_PAGE );
//Put the XML into an array
$XML_ARRAY = makexmlarray( $XML_FILE_CONTENTS, 0 );
(int)$v_iTotalNames = (int)count( $XML_ARRAY['tinychat']['names'] );
echo'<table align="center" cellspacing="5" >';
(int)$v_CLOSETR = 0;
//The Ghettoest shit on the block But it works like a nigga on a stick
//Makes 3 col's of usernames :) it would also be easy to check if the username had a image and if it does turn it into a hyperlink
//seems rather pointless with all the images already on the screen
for( (int)$i = 0; (int)$i <= (int)$v_iTotalNames; (int)$i++ )
{
if( $XML_ARRAY['tinychat']['names'] != "" )
{
if( (int)$i % 3 == 0 )
(int)$v_ISREMAINDER = 0;
else
(int)$v_ISREMAINDER = 1;
if( (int)$v_ISREMAINDER == 0 )
{
(int)$v_CLOSETR = 0;
echo'<tr>';
}
if( (int)$v_CLOSETR > 3 )
(int)$v_CLOSETR = 0;
echo '<td>'.$XML_ARRAY['tinychat']['names'][(int)$i].'</td>';
if( (int)$v_ISREMAINDER == 0 && (int)$v_CLOSETR == 3 )
{
echo'</tr>';
}
(int)$v_CLOSETR += 1;
}
}
echo'</table>';
}
}
else
{
echo'<table align="center" cellspacing="5"><tr><td colspan=2 align="center"> <font size="6" color="#FF0000" ><strong>ERROR - MOTHERFUCKER!!!</strong></font></td></tr></table>';
}
}
}
else
{
echo'<table align="center" cellspacing="5">';
if( $_POST['pass_submit'] )
{
if( $_POST['pass'] != "" )
{
echo'<tr><td colspan=2 align="center"> <font size="6" color="#FF0000" ><strong>INVALID PASS!</strong></font></td></tr>';
}
else if( $_POST['pass'] == "" )
{
echo'<tr><td colspan=2 align="center"> <font size="6" color="#FF0000" ><strong>ENTER A PASS!</strong></font></td></tr>';
}
}
echo'<form action=',$v_DOCUMENT_NAME,' method="post" name="pass_submit">
<tr><td></td></tr>
<tr>
<td align="center">Password</td>
</tr>
<tr>
<td align="center"><input type="password" class="input" name="pass" /></td>
</tr>
<tr>
<td colspan=2 align="center"><input type="submit" class="button" name="pass_submit" value="login" /></td>
</tr>
</form>';
echo'</table>';
}
echo'</body>
<table align="center" cellspacing="5">
<tr><td colspan=2 align="center"><img src="http://tinychat.com/public/images/island_fun.png" alt="FUNISLANDTHING" /></td></tr>
<tr><td colspan=2 align="center">Created By - <font color="#0000FF">Gellin</font> and <font color="#006633">TheOneSage</font></td></tr>
</table>
</html>';
?>