rendered paste body<?php
$VAR[4] = $usr['name'];
$VAR[0] = "http://dramadome.com";
?>
<table style="width:100%;" cellpadding="8" cellspacing="8">
<tr>
<td style="font-size:8pt;" class="color">
<table cellpadding="0" cellspacing="0">
<tr>
<td style="font-size:8pt;padding-right:5px;" class="item3">
<b><span style="font-size:12pt;">M</span>ENU:</b>
</td>
<?php
if ( isset($_GET['cat']) ) {
$tempcat = $_GET['cat'];
$sql="SELECT * FROM `arcade_categories` WHERE catname = '$tempcat'";
$result=mysql_query($sql) or die(mysql_error());
$catcheck = mysql_num_rows($result);
if ($catcheck > 0) {
$cat = $tempcat;
}
else {
$cat = "random";
}
}
else {
$cat = "random";
}
echo "
<td style='vertical-align:bottom;'>
<div class='";if($cat == "random"){echo "item2";}else {echo "item";}
echo "
' onmouseover='this.className=\"item2\"; onmouseout='this.className=\"item\";'>
<a href='$VAR[0]/plug.php?e=inc&f=arcade'>Random</a>
</div>
</td>
";
$sql="SELECT * FROM `arcade_categories` ORDER BY `displayorder`";
$result=mysql_query($sql);
$catnum = mysql_num_rows($result);
for($i = 0; $i < $catnum; $i++) {
$row = mysql_fetch_array($result);
$catname = $row["catname"];
echo "
<td class='item3'> </td>
<td style='vertical-align:bottom;' onclick='window.location.href=\"$VAR[0]/plug.php?e=inc&f=arcade&cat=$catname\";'>
<div class='";if($cat == $catname){echo "item2";}else {echo "item";}
echo "
' onmouseover='this.className=\"item2\";' onmouseout='this.className=\"";if($cat == $catname){echo "item2";}else {echo "item";}echo "\";'>
<a href='$VAR[0]/plug.php?e=inc&f=arcade&cat=$catname'>$catname</a>
</div>
</td>
";
}
?>
<td class="item3">
<div> </div>
</td>
<td class="item3">
<div> </div>
</td>
</tr>
</table>
</td>
</tr>
</table>
<?php
if ($_REQUEST['sessdo'] == 'sessionstart')
{
$sgame = $_REQUEST['gamename'];
echo "&connStatus=1&initbar=$gamerand&gametime=" . TIMENOW . "&lastid=$lastid&result=OK";
echo "<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=\"plug.php?e=inc&f=arcade?game=$sgame\">";
}
if ($_REQUEST['sessdo'] == 'permrequest')
{
echo" Error";
echo "&validate=1µone=$microone&result=OK";
$score = $_REQUEST["score"];
$s2game = $_SESSION['sgameid'];
$username = $VAR[4];
$sql = "INSERT INTO `arcade_highscores` (gamename, username, score) VALUES ('$s2game', '$username', '$score')";
$result=mysql_query($sql) or die(mysql_error());
exit;
}
if ($_REQUEST['sessdo'] == 'burn')
{
$gamename = $_SESSION['sgameid'];
$sql="SELECT * FROM `arcade_games` WHERE `gameid` = '$gamename' LIMIT 1";
$result=mysql_query($sql);
$row = mysql_fetch_array($result);
$shortname = $row["shortname"];
$title = $row["title"];
$gameid = $row["gameid"];
$stdimage = $row["stdimage"];
$description = $row["description"];
$thiscat = $row["categoryid"];
$timesplayed = $row["timesplayed"];
$namecheck = $VAR[4];
$isreverse = $row["isreverse"];
echo "
<table width='100%' border='0' align='center'>
<tr>
<td style='font-size: 8pt; padding-right: 5px;' class='item3'>
<br />
<b><span style='font-size: 12pt;'>H</span>igh <span style='font-size: 12pt;'>S</span>cores</b>
</td>
</tr>
<tr>
<td valign='top' width='40%'>
<br />
<table class='border2' width='100%' border='0' align='center'>
<tr>
<td class='mainmenu5' colspan='3'><div align='center'><b>$title</b></div></td>
</tr>
<tr>
<td width='100%' colspan='2'>
<div align = 'center'>
<br />
<a href='$VAR[0]/plug.php?e=inc&f=arcade&play=$hsgameid'><img src='arcade/images/$stdimage' border='2' /></a>
</div>
<b><center><a href='$VAR[0]/plug.php?e=inc&f=arcade&play=$gameid'>$title</a></center></b>
<div align = 'center'>
$description
</div>
<div align='center' style='padding: 5px'>
<a href='$VAR[0]/plug.php?e=inc&f=arcade&play=$gameid'><b>Play this game!</b></a>
</div>
<div align='center' style='padding: 5px'>
Times played: $timesplayed
</div>
</td>
</tr>
</table>
<br />
</td>
<td valign='top' width='40%'>
<br />
<table class='border2' width='100%' border='0' align='center'>
<tr>
<td class='mainmenu5' colspan='3'><div align='center'><b>Overall High Scores</b></div></td>
</tr>
<tr>
<td width='20'><b>#</b></td>
<td width='120'><b>Member</b></td>
<td width='110'><b>Score</b></td>
</tr>
";
if($isrverse == 1){
$sql="SELECT * FROM `arcade_highscores` WHERE `gamename` = '$gameid' ORDER BY `score` LIMIT 100";
}
else{
$sql="SELECT * FROM `arcade_highscores` WHERE `gamename` = '$gameid' ORDER BY `score` DESC LIMIT 100";
}
$result=mysql_query($sql);
for($i = 0; $i < 100; $i++) {
$row = mysql_fetch_array($result);
$username = $row["username"];
$score = $row["score"];
$rank = $i + 1;
echo "
<tr>
<td>$rank.</td>
<td>
";
if ($username == $namecheck){
echo "
<b>
";
}
echo "
<a href='$VAR[0]/$username'>$username</a>
";
if ($username == $namecheck){
echo "
</b>
";
}
echo "
</td>
<td>$score</td>
</tr>
";
}
echo"
</table>
<br />
</td>
<td valign='top' width='20%'>
<br />
<table class='border2' width='100%' border='0' align='center'>
<tr>
<td class='mainmenu5' colspan='3'><div align='center'><b>Your High Scores</b></div></td>
</tr>
<tr>
<td width='33%'><b>#</b></td>
<td width='66%'><b>Score</b></td>
</tr>
";
if($isreverse == 1){
$sql="SELECT * FROM `arcade_highscores` WHERE `gamename` = '$gameid' AND `username` = '$VAR[4]' ORDER BY `score` LIMIT 100";
}
else{
$sql="SELECT * FROM `arcade_highscores` WHERE `gamename` = '$gameid' AND `username` = '$VAR[4]' ORDER BY `score` DESC LIMIT 100";
}
$result=mysql_query($sql);
$rescheck = mysql_num_rows($result);
for($i = 0; $i < 100; $i++) {
$row = mysql_fetch_array($result);
$score = $row["score"];
$rank = $i + 1;
echo "
<tr>
<td>$rank.</td>
<td>$score</td>
</tr>
";
}
echo"
</table>
<br />
</td>
</tr>
</table>
</td.
</tr>
</table>
";
}
else if (isset($_GET['play'])){
$thisgameid = $_GET['play'];
$_SESSION['sgameid'] = $thisgameid;
$sql="SELECT * FROM `arcade_games` WHERE `gameid` = '$thisgameid' LIMIT 1";
$result=mysql_query($sql);
$row = mysql_fetch_array($result);
$shortname = $row["shortname"];
$title = $row["title"];
$gameid = $row["gameid"];
$stdimage = $row["stdimage"];
$description = $row["description"];
$thiscat = $row["categoryid"];
$timesplayed = $row["timesplayed"];
$file = $row["file"];
$width = $row["width"];
$height = $row["height"];
$gamename = $row["shortname"];
$isreverse = $row["isreverse"];
$timesnew = $timesplayed + 1;
$sqlplay="UPDATE `arcade_games` SET `timesplayed` = '$timesnew' WHERE `gameid` = '$thisgameid' LIMIT 1";
$resultplay=mysql_query($sqlplay);
$acta = mysql_query("SELECT * FROM `user_info` WHERE `user` = '$VAR[4]'");
$actb = mysql_fetch_array($acta);
$actpa = $actb["total"];
$actpb = $actpa + 1;
$actsql = mysql_query("UPDATE `user_info` SET `total` = '$actpb' WHERE `user` = '$VAR[4]' LIMIT 1");
if($isreverse == 1){
$sql="SELECT * FROM `arcade_highscores` WHERE `gamename` = '$gameid' ORDER BY `score` LIMIT 1";
}
else{
$sql="SELECT * FROM `arcade_highscores` WHERE `gamename` = '$gameid' ORDER BY `score` DESC LIMIT 1";
}
$result=mysql_query($sql);
$champnum = mysql_num_rows($result);
if($champnum == 1){
$row = mysql_fetch_array($result);
$champname = $row["username"];
$champscore = $row["score"];
}
else {
$champname = "None";
$champscore = 0;
}
echo"
<table cellpadding='0' cellspacing='0' border='0' align='center'>
<tr>
<td valign='top' width='$width' align='center' nowrap='nowrap'>
<table cellpadding='6' cellspacing='1' border='0' width='$width' align='center'>
<tr align='center'>
<td class='border2' align='center'>
<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,14,0' width='$width' height='$height'>
<param name='movie' value='/arcade/swf/$file'>
<param name='quality' value='high'>
<embed src='/arcade/swf/$file' quality='high' width='$width' height='$height' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash'></embed>
</object>
</td>
</tr>
</table>
</td>
<td width='10%'>
</td>
<td valign='top' width='200'>
<table class='border2' cellpadding='6' cellspacing='1' border='0' width='200' align='center'>
<tr align='center'>
<td class='border2'><a href='$VAR[0]/plug.php?e=inc&f=arcade&play=$gameid'>$title</a></td>
</tr>
<tr align='center'>
<td align='center'>
<img src='/arcade/images/$stdimage' border='2' />
</td>
</tr>
<tr align='center'>
<td align='center'>
<div>$title Champion:</div>
<b><a href='$VAR[0]/$champname' target='_blank'>$champname</a></b> <img src='/arcade/images/trophy.gif' border='0' align='absmiddle' />
</td>
</tr>
<tr align='center'>
<td align='center'>
<div class='smallfont'>Score to Beat:</div>
<b>$champscore</b>
</td>
</tr>
<tr align='center'>
<td align='center'>
<div><a href='plug.php?e=inc&f=arcade?'>Play More Games</a></div>
<div><a href='$VAR[0]/plug.php?e=inc&f=arcade?highscore=$gameid'>[View High Scores]</a></div>
</td>
</tr>
<tr align='center'>
<td align='center'>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<br />
<br />
</td>
</tr>
</table>
";
}
else if (isset($_GET['highscore'])){
$hsgameid = $_GET['highscore'];
$sql="SELECT * FROM `arcade_games` WHERE `gameid` = '$hsgameid' LIMIT 1";
$result=mysql_query($sql);
$row = mysql_fetch_array($result);
$shortname = $row["shortname"];
$title = $row["title"];
$gameid = $row["gameid"];
$stdimage = $row["stdimage"];
$description = $row["description"];
$thiscat = $row["categoryid"];
$timesplayed = $row["timesplayed"];
$isreverse = $row["isreverse"];
echo"
<table width='100%' border='0' align='center'>
<tr>
<td style='font-size: 8pt; padding-right: 5px;' class='item3'>
<br />
<b><span style='font-size: 12pt;'>H</span>igh <span style='font-size: 12pt;'>S</span>cores</b>
</td>
</tr>
<tr>
<td valign='top' width='40%'>
<br />
<table class='border2' width='100%' border='0' align='center'>
<tr>
<td class='mainmenu5' colspan='3'><div align='center'><b>$title</b></div></td>
</tr>
<tr>
<td width='100%' colspan='2'>
<b><font size='4'><center><a href='$VAR[0]/plug.php?e=inc&f=arcade&play=$hsgameid'>$title</a></center></font></b>
<div align = 'center'>
<font size='3'>$description</font>
</div>
<div align = 'center' style='padding: 4px;'>
<br />
<a href='$VAR[0]/plug.php?e=inc&f=arcade&play=$hsgameid'><img src='/arcade/images/$stdimage' border='2'></a>
</div>
<div align='center' style='padding: 5px'>
<a href='$VAR[0]/plug.php?e=inc&f=arcade&play=$hsgameid'><b>Play this game!</b></a>
</div>
<div align='center' style='padding: 5px'>
Times played: $timesplayed
</div>
</td>
</tr>
</table>
<br />
</td>
<td valign='top' width='40%'>
<br />
<table class='border2' width='100%' border='0' align='center'>
<tr>
<td class='mainmenu5' colspan='3'><div align='center'><b>Overall High Scores</b></div></td>
</tr>
<tr>
<td width='20'><b>#</b></td>
<td width='120'><b>Member</b></td>
<td width='110'><b>Score</b></td>
</tr>
";
$namecheck = $VAR[4];
if($isrverse == 1){
$sql="SELECT * FROM `arcade_highscores` WHERE `gamename` = '$gameid' ORDER BY `score` LIMIT 100";
}
else{
$sql="SELECT * FROM `arcade_highscores` WHERE `gamename` = '$gameid' ORDER BY `score` DESC LIMIT 100";
}
$result=mysql_query($sql);
for($i = 0; $i < 100; $i++) {
$row = mysql_fetch_array($result);
$username = $row["username"];
$score = $row["score"];
$rank = $i + 1;
echo "
<tr>
<td>$rank.</td>
<td>
";
if ($username == $namecheck){
echo "
<b>
";
}
echo "
<a href='$VAR[0]/$username'>$username</a>
";
if ($username == $namecheck){
echo "
</b>
";
}
echo "
</td>
<td>$score</td>
</tr>
";
}
echo"
</table>
<br />
</td>
<td valign='top' width='20%'>
<br />
<table class='border2' width='100%' border='0' align='center'>
<tr>
<td class='mainmenu5' colspan='3'><div align='center'><b>Your High Scores</b></div></td>
</tr>
<tr>
<td width='33%'><b>#</b></td>
<td width='66%'><b>Score</b></td>
</tr>
";
if($isreverse == 1){
$sql="SELECT * FROM `arcade_highscores` WHERE `gamename` = '$gameid' AND `username` = '$VAR[4]' ORDER BY `score` LIMIT 100";
}
else{
$sql="SELECT * FROM `arcade_highscores` WHERE `gamename` = '$gameid' AND `username` = '$VAR[4]' ORDER BY `score` DESC LIMIT 100";
}
$result=mysql_query($sql);
$rescheck = mysql_num_rows($result);
for($i = 0; $i < 100; $i++) {
$row = mysql_fetch_array($result);
$score = $row["score"];
$rank = $i + 1;
echo "
<tr>
<td>$rank.</td>
<td>$score</td>
</tr>
";
}
echo"
</table>
<br />
</td>
</tr>
</table>
";
}
// show games list
else {
function dbg_mysql_query($query) {
echo '<fieldset><legend>sql query</legend>', htmlentities($query), "<br />\n";
$r = mysql_query($query);
if (!$r) {
echo mysql_error();
}
else {
echo 'num_rows: ', mysql_num_rows($r);
}
echo "</fieldset>\n";
return $r;
}
echo "
<table style='width:100%;' cellpadding='0' cellspacing='0'>
<tr>
<td style='width:75%;vertical-align:top;'>
<table style='width:100%;' cellpadding='1' cellspacing='1'>
<tr>
<td style='vertical-align:top;font-size:10pt;text-align:center;' class='color'>
Welcome to the Arcade! <br />
You are browsing games in the $cat category.<br/>
</td>
</tr>
</table>
<table style='width:100%;' cellpadding='8' cellspacing='0'>
<tr>
<td style='text-align:left;vertical-align:middle;'>
<table class='border2' style='width:100%;'>
<tr>
<td class='mainmenu5' style='width:15%;'>
</td>
<td class='mainmenu5' style='width:30%;'>
<b>Game</b>
</td>
<td class='mainmenu5' style='width:15%;'>
<b>Category</b>
</td>
<td class='mainmenu5' style='width:20%;'>
<b>Champion</b>
</td>
<td class='mainmenu5' style='width:20%;'>
<b>Your Best</b>
</td>
</tr>
</table>
";
if ($cat == 'random')
{
$sql1 = "SELECT * FROM `arcade_games` ORDER BY `title`";
}
else
{
$sql = "SELECT * FROM `arcade_categories` WHERE `catname` = '$cat' LIMIT 1";
$result=mysql_query($sql) or die('Could not run the query for catnames: ' . mysql_error());
$row = mysql_fetch_array($result);
$maincat = $row["catid"];
$sql1="SELECT * FROM `arcade_games` WHERE `categoryid` = '$maincat' ORDER BY `shortname`";
}
$result1 = mysql_query($sql1) or die ('Could not process sql1 query: ' . mysql_error());
$gamenum = mysql_num_rows($result1);
// This is for the looping construct
$game_array = array();
if ($gamenum > 0)
{
while ($row = mysql_fetch_array($result1))
{
$game_array[] = $row;
}
}
$game_count = count($game_array);
// End loop construct stuff
$begin = 0;
$end = 20;
if ($gamenum < 20)
{
$end = $gamenum;
}
elseif ( isset($_GET['begin']) )
{
$begin = intval($_GET['begin']); // What is someone passed begin=fred in the URI?
$end = ( ($begin + 20) < $game_count ) ? $begin + 20 : $game_count;
}
for($i = $begin; $i < $end; $i++) {
$shortname = $game_array[$i]["shortname"];
$title = $game_array[$i]["title"];
$gameid = $game_array[$i]["gameid"];
$stdimage = $game_array[$i]["stdimage"];
$description = $game_array[$i]["description"];
$thiscat = $game_array[$i]["categoryid"];
$isreverse = $game_array[$i]["isreverse"];
$sql2="SELECT * FROM `arcade_categories` WHERE `catid` = $thiscat LIMIT 1";
$result2=mysql_query($sql2) or die('Could not run the inner loop query: ' . mysql_error());
$row = mysql_fetch_array($result2);
$tempcat = $row["catname"];
if($isreverse == 1){
$sql3="SELECT * FROM `arcade_highscores` WHERE `gamename` = '$gameid' ORDER BY `score` LIMIT 1";
}
else{
$sql3="SELECT * FROM `arcade_highscores` WHERE `gamename` = '$gameid' ORDER BY `score` DESC LIMIT 1";
}
$result3=mysql_query($sql3);
$champnum = mysql_num_rows($result3);
if($champnum == 1){
$row = mysql_fetch_array($result3);
$champname = $row["username"];
$champscore = $row["score"];
}
else {
$champname = "None";
$champscore = 0;
}
$user = $VAR[4];
$sql4="SELECT * FROM `arcade_highscores` WHERE `gamename` = '$gameid' AND `username` = '$user' ORDER BY `score` DESC LIMIT 1";
$result4=mysql_query($sql4);
$row4 = mysql_fetch_array($result4);
$scorenum = mysql_num_rows($result4);
if($scorenum == 1){
$yourscore = $row4["score"];
}
else {
$yourscore = "None";
}
echo "
<table style='width:100%;'>
<tr>
<td style='width:15%;text-align:center;font-size:11pt;' class='color'>
<a href='$VAR[0]/plug.php?e=inc&f=arcade&play=$gameid'><img src='/arcade/images/$stdimage' border='2'></a>
</td>
<td style='width:30%;vertical-align:top;font-size:11pt;' class='color'>
<b><a href='$VAR[0]/plug.php?e=inc&f=arcade&play=$gameid'>$title</a></b>
<div style='font-size:10pt;'>
$description
</div>
</td>
<td style='width:15%;text-align:center;font-size:11pt;' class='color'>
<b>$tempcat</b><br />
(<a href='$VAR[0]/plug.php?e=inc&f=arcade&cat=$tempcat'>More</a>)</td>
<td style='width:20%;text-align:center;font-size:11pt;' class='color'>
<b><a href='$VAR[0]/$champname'>$champname</a></b>
<div style='font-size:10pt;'>
With a high score of:<br />
<b>$champscore</b> </div>
</td>
<td style='width:20%;text-align:center;font-size:11pt;' class='color'>
Your high score:
<br />
<b>$yourscore</b>
<br />
[<a href='$VAR[0]/plug.php?e=inc&f=arcade?highscore=$gameid'>High Scores</a>]
</td>
</tr>
</table>
";
}
}
?>
</td>
</tr>
<tr>
<td>
<?php
echo"This category has $gamenum games. Display page: ";
$link = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
if ( isset($_GET['cat']) ) {
$tempcat = $_GET['cat'];
$gnumcheck = 0;
$x = 0;
while($gamenum > $gnumcheck){
$gnumcheck += 1;
$x += 1;
echo" | <a href='$VAR[0]/plug.php?e=inc&f=arcade&cat=$tempcat&begin=$gnumcheck'>$x</a>";
$gnumcheck += 19;
}
}
else {
$gnumcheck = 0;
$x = 0;
while($gamenum > $gnumcheck){
$gnumcheck += 1;
$x += 1;
echo" | <a href='$VAR[0]/plug.php?e=inc&f=arcade?begin=$gnumcheck'>$x</a>";
$gnumcheck += 19;
}
}
?>
</td>
</tr>
</table
</td>
</tr>
</table>