Page 1 of 1

Arcade script not working... help please!

Posted: Thu May 25, 2006 1:50 pm
by Citizen
I hand coded this whole bit and only one part is giving me trouble...

Basicallly I have one page, arcade.php, that has all of the code for the whole arcade.

If the user selects a category, the category's games are displayed. Works.
If the user selects a game, the game will play. Works.
If the user selects to the the high scores for a game, the highscore chart is dispalyed. Works.
When the user plays a game, the swf file exports the score, but nothing happens. <- Problem

Here is the arcade:

http://www.gamerbio.com/arcade.php

The part if (isset($_GET['score'])){ is supposed to start the section where the score's variable is supposed to get picked up and updated into the database. Im thinking the page needs to be refreshed when the info is sent for the content to change.


Here is the code for arcade.php:


Code: Select all

<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">

&nbsp;&nbsp;

<b><span style="font-size:12pt;">M</span>ENU:</b>

&nbsp;&nbsp;

</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]/arcade.php'>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'>&nbsp;</td>
	<td style='vertical-align:bottom;' onclick='window.location.href=\"$VAR[0]/arcade.php?cat=$catname\";'>
	<div class='
";
if($catname == $cat){
echo "item2";
}
else {
echo "item";
}
echo"
	' onmouseover='this.className=\"item2\";' onmouseout='this.className=\"item\";'>
	<a href='$VAR[0]/arcade.php?cat=$catname'>$catname</a>
	</div>
	</td>

";
} 
?> 


<td class="item3">
<div>&nbsp;&nbsp;</div>
</td>

<td class="item3">
<div>&nbsp;&nbsp;</div>
</td>
</tr>
</table>

</td>
</tr>
</table>
<?php
if (isset($_GET['score'])){
	$score = $_POST["score"];
	$gamename = $_POST["gamename"];
	$username = $VAR[4];

	$sql = "INSERT INTO `arcade_highscores` (gamename, username, score) VALUES ('$gamename', '$username', '$score')";
	$result=mysql_query($sql) or die(mysql_error());


	$sql="SELECT * FROM `arcade_games` WHERE `gamename` = '$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 />
		
		&nbsp;&nbsp;
		
		<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 style='padding: 4px 4px 4px 4px; float: right' align='right'>
					<br />
					<a href='$VAR[0]/arcade.php?play=$hsgameid'><img src='images/arcade/$stdimage' border='2' /></a>
				</div>
				<b><a href='$VAR[0]/arcade.php?play=$gameid'>$title</a></b>
			        <div>
					$description
			        </div>
				<div align='center' style='padding: 5px'>
				<a href='$VAR[0]/arcade.php?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 `gameid` = '$gameid' ORDER BY `score` LIMIT 100";
	}
	else{
	$sql="SELECT * FROM `arcade_highscores` WHERE `gameid` = '$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 `gameid` = '$gameid', `username` = '$VAR[4]' ORDER BY `score` LIMIT 100";
	}
	else{
		$sql="SELECT * FROM `arcade_highscores` WHERE `gameid` = '$gameid', `username` = '$VAR[4]' ORDER BY `score` DESC LIMIT 100";
	}
	$result=mysql_query($sql);
	$rescheck = mysql_num_rows($result);
	for($i = 0; $i < $rescheck; $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'];
	$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"];

	if($isreverse == 1){
		$sql="SELECT * FROM `arcade_highscores` WHERE `gamename` = '$shortname' ORDER BY `score` LIMIT 1";
	}
	else{
		$sql="SELECT * FROM `arcade_highscores` WHERE `gamename` = '$shortname' 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' nowrap='nowrap'>
		<table cellpadding='6' cellspacing='1' border='0' width='100%' align='center'>
			<tr align='center'>
			  <td>	  
			<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 valign='top' width='100%'>
		<table cellpadding='6' cellspacing='1' border='0' width='100%' align='center'>
			<tr align='center'>
			  <td width='100%'><a href='$VAR[0]/arcade.php?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='arcade.php?'>Play More Games</a></div>
				<div><a href='$VAR[0]/arcade.php?highscore=$gameid'>[View High Scores]</a></div>
			  </td>
			</tr>
				<tr align='center'>
			  <td align='center'>
			  </td>
			</tr>
		</table>
		</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 />
		&nbsp;&nbsp;
		<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 style='padding: 4px; float: right' align='right'>
					<br />
					<a href='$VAR[0]/arcade.php?play=$gameid'><img src='/arcade/images/$stdimage' border='2'></a>
				</div>
				<b><a href='$VAR[0]/arcade.php?play=$hsgameid'>$title</a></b>
			        <div>
					$description
			        </div>
				<div align='center' style='padding: 5px'>
				<a href='$VAR[0]/arcade.php?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 `gameid` = '$gameid' ORDER BY `score` LIMIT 100";
	}
	else{
	$sql="SELECT * FROM `arcade_highscores` WHERE `gameid` = '$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 `gameid` = '$gameid', `username` = '$VAR[4]' ORDER BY `score` LIMIT 100";
	}
	else{
		$sql="SELECT * FROM `arcade_highscores` WHERE `gameid` = '$gameid', `username` = '$VAR[4]' ORDER BY `score` DESC LIMIT 100";
	}
	$result=mysql_query($sql);
	$rescheck = mysql_num_rows($result);
	for($i = 0; $i < $rescheck; $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>
	";
}
else {
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'){
	$sql="SELECT * FROM `arcade_games` ORDER BY `title`";
}
else{
$sql="SELECT * FROM `arcade_categories` WHERE `catname` = '$cat' LIMIT 1";
$result=mysql_query($sql);
$row = mysql_fetch_array($result);
$maincat = $row["catid"];

$sql="SELECT * FROM `arcade_games` WHERE `categoryid` = '$maincat' ORDER BY `shortname`";
}
$result=mysql_query($sql);
$gamenum = mysql_num_rows($result);
for($i = 0; $i < $gamenum; $i++) {
	$row = mysql_fetch_array($result);
	$shortname = $row["shortname"];
	$title = $row["title"];
	$gameid = $row["gameid"];
	$stdimage = $row["stdimage"];
	$description = $row["description"];
	$thiscat = $row["categoryid"];
	$isreverse = $row["isreverse"];

	$sql="SELECT * FROM `arcade_categories` WHERE `catname` = '$thiscat' LIMIT 1";
	$result=mysql_query($sql);
	$row = mysql_fetch_array($result);
	$tempcat = $row["catname"];

	if($isreverse == 1){
		$sql="SELECT * FROM `arcade_highscores` WHERE `gamename` = '$shortname' ORDER BY `score` LIMIT 1";
	}
	else{
		$sql="SELECT * FROM `arcade_highscores` WHERE `gamename` = '$shortname' 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;
	}

	$sql="SELECT * FROM `arcade_highscores` WHERE `username` = '$VAR[4]' ORDER BY `score` DESC LIMIT 1";
	$result=mysql_query($sql);
	$scorenum = mysql_num_rows($result);
	if($scorenum == 1){
		$row = mysql_fetch_array($result);
		$yourscore = $row["score"];
	}
	else {
		$yourscore = "None";
	}	
	echo "
			<table style='width:100%;'>
				<tr>
				<td style='width:15%;text-align:center;font-size:11pt;' class='color'>
				<img src='/games/images/$stdimage' border='2'>
				</td>
				<td style='width:30%;vertical-align:top;font-size:11pt;' class='color'>
				<b><a href='$VAR[0]/arcade.php?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]/arcade.php?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]/arcade.php?highscore=$gameid'>High Scores</a>]
				</td>
				</tr>
			</table>
		";
	}
}
?>
			</td>
			</tr>
		</table
	
	</td>
	</tr>
</table>
Here is the code from the game (I did not make this script, but it does work on other arcades and I cant change this script):


Code: Select all

// HERE THE ARCADE SESSION IS INITIATED
// DON'T FORGET TO CHANGE THE GAMENAME VALUE!
if (this.sessionstarted != 1) {
	this.arcade = new LoadVars();
	this.sessionvars = new LoadVars();
	this.arcade.gamename = "towerball";
	this.arcade.sessdo = "sessionstart";
	this.arcade.sendAndLoad("arcade.php", sessionvars, "POST");
	this.sessionstarted = 1;
}

// IF GAMEOVER=1, SUBMIT THE SCORE AND REDIRECT THE PAGE
if (_root.gameover == 1) {
	if ((this.askpermission != 1) && (this.sessionvars.connStatus == 1)) {
		this.prequestvars = new LoadVars();
		this.pranswer = new LoadVars();
		this.prequestvars.gametime = this.sessionvars.gametime;
		this.prequestvars.fakekey = this.sessionvars.initbar;
		if (_root.score == 0) {
			this.prequestvars.score = -1;
		} else {
			this.prequestvars.score = _root.score;
		}
		this.prequestvars.id = this.sessionvars.lastid;
		this.prequestvars.sessdo = "permrequest";
		this.prequestvars.note = (this.prequestvars.id*this.prequestvars.score*this.prequestvars.fakekey);
		this.prequestvars.sendAndLoad("./arcade.php", this.pranswer, "POST");
		this.askpermission = 1;
	}
	if ((this.pranswer.validate == 1) && (this.finalsent != 1)) {
		this.burnscore = new LoadVars();
		this.burnscore.microone = this.pranswer.microone;
		this.burnscore.gametime = this.prequestvars.gametime;
		this.burnscore.id = this.prequestvars.id;
		if (_root.score == 0) {
			this.burnscore.noscore = 1;
		}
		this.burnscore.sessdo = "burn";
		this.burnscore.send("./arcade.php", "_self", "POST");
		this.finalsent = 1;
	}
}

Re: Arcade script not working... help please!

Posted: Thu May 25, 2006 5:32 pm
by timvw
Citizen wrote: When the user plays a game, the swf file exports the score, but nothing happens. <- Problem
[

And the problem is? Can't you snip the irrelevant parts?

Posted: Thu May 25, 2006 7:21 pm
by Citizen
Ok, here's the code in the swf game that I cant change. This works on other arcade systems and I need to make my php code work with it in order to be compatable with all of the games that were published with this code:

Code: Select all

// HERE THE ARCADE SESSION IS INITIATED 
// DON'T FORGET TO CHANGE THE GAMENAME VALUE! 
if (this.sessionstarted != 1) { 
   this.arcade = new LoadVars(); 
   this.sessionvars = new LoadVars(); 
   this.arcade.gamename = "towerball"; 
   this.arcade.sessdo = "sessionstart"; 
   this.arcade.sendAndLoad("arcade.php", sessionvars, "POST"); 
   this.sessionstarted = 1; 
} 

// IF GAMEOVER=1, SUBMIT THE SCORE AND REDIRECT THE PAGE 
if (_root.gameover == 1) { 
   if ((this.askpermission != 1) && (this.sessionvars.connStatus == 1)) { 
      this.prequestvars = new LoadVars(); 
      this.pranswer = new LoadVars(); 
      this.prequestvars.gametime = this.sessionvars.gametime; 
      this.prequestvars.fakekey = this.sessionvars.initbar; 
      if (_root.score == 0) { 
         this.prequestvars.score = -1; 
      } else { 
         this.prequestvars.score = _root.score; 
      } 
      this.prequestvars.id = this.sessionvars.lastid; 
      this.prequestvars.sessdo = "permrequest"; 
      this.prequestvars.note = (this.prequestvars.id*this.prequestvars.score*this.prequestvars.fakekey); 
      this.prequestvars.sendAndLoad("./arcade.php", this.pranswer, "POST"); 
      this.askpermission = 1; 
   } 
   if ((this.pranswer.validate == 1) && (this.finalsent != 1)) { 
      this.burnscore = new LoadVars(); 
      this.burnscore.microone = this.pranswer.microone; 
      this.burnscore.gametime = this.prequestvars.gametime; 
      this.burnscore.id = this.prequestvars.id; 
      if (_root.score == 0) { 
         this.burnscore.noscore = 1; 
      } 
      this.burnscore.sessdo = "burn"; 
      this.burnscore.send("./arcade.php", "_self", "POST"); 
      this.finalsent = 1; 
   } 
}
Here is my code that needs to work with the script above.

Code: Select all

if (isset($_GET['score'])){ 
        $score = $_POST["score"]; 
        $gamename = $_POST["gamename"]; 
        $username = $VAR[4]; 

        $sql = "INSERT INTO `arcade_highscores` (gamename, username, score) VALUES ('$gamename', '$username', '$score')"; 
        $result=mysql_query($sql) or die(mysql_error()); 


        $sql="SELECT * FROM `arcade_games` WHERE `gamename` = '$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 /> 
                
                &nbsp;&nbsp; 
                
                <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 style='padding: 4px 4px 4px 4px; float: right' align='right'> 
                                        <br /> 
                                        <a href='$VAR[0]/arcade.php?play=$hsgameid'><img src='images/arcade/$stdimage' border='2' /></a> 
                                </div> 
                                <b><a href='$VAR[0]/arcade.php?play=$gameid'>$title</a></b> 
                                <div> 
                                        $description 
                                </div> 
                                <div align='center' style='padding: 5px'> 
                                <a href='$VAR[0]/arcade.php?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 `gameid` = '$gameid' ORDER BY `score` LIMIT 100"; 
        } 
        else{ 
        $sql="SELECT * FROM `arcade_highscores` WHERE `gameid` = '$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 `gameid` = '$gameid', `username` = '$VAR[4]' ORDER BY `score` LIMIT 100"; 
        } 
        else{ 
                $sql="SELECT * FROM `arcade_highscores` WHERE `gameid` = '$gameid', `username` = '$VAR[4]' ORDER BY `score` DESC LIMIT 100"; 
        } 
        $result=mysql_query($sql); 
        $rescheck = mysql_num_rows($result); 
        for($i = 0; $i < $rescheck; $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> 
        "; 
}
What I need it to do is, when the swf reaches gameover and the top script there executes, I need arcade.php (the location of both the game and the php code) to reload as set by the swf code.

Thanks!