no, maybe I didn't do that. I am so confused right now my brain hurts.
here is the entire scores.php:
Code:
<?php
$winscore = (int)$winscore;
// Create a Blank File if it doesn't already exist
if (!file_exists($filename))
{
$file=fopen($filename, "w");
fclose ($file);
}
// Read the file in
$oscores = file ($filename);
$numreadin = count($oscores);
// Break out the data into a new 2-d array called $tscores
for ($i = 0; $i < $numreadin; $i++)
{
$g = unserialize($oscores[$i]);
$tscores[$i][0] = $g[0];
$tscores[$i][1] = $g[1];
}
// Fill in any missing data with none/0
for ($i = $numreadin; $i < $scoresize; $i++)
{
$tscores[$i][0] = 0;
$tscores[$i][1] = "";
}
// Process the actions
// Insert a score/name
if ($action == "INSERT")
{
// Add name to end of list, and sort
$tscores[$scoresize + 1][0] = $winscore;
$tscores[$scoresize + 1][1] = $winname;
rsort ($tscores);
$file=fopen($filename, "w");
// Write them out
for ($i = 0; $i < $scoresize; $i++)
{
$st = serialize($tscores[$i]) . "\n";
fputs($file, $st);
}
fclose($file);
}
// Clear the list
if ($action == "CLEAR")
{
$k[0] = 0;
$k[1] = "no-one";
$ser = serialize($k);
$file=fopen($filename, "w");
for ($i = 0; $i < $scoresize; $i++)
{
$st = $ser . "\n";
fputs($file, $st);
}
fclose($file);
}
// Process the OUTPUT options
if ($viewtype == "HTML")
{
// HTML PAGE CREATED HERE
?>
<table cellpadding=2 cellspacing=2 border=0 width="330">
<tr align=center>
<th bgcolor="#663300" width="80"><font color="#ffff00" face="Arial, Helvetica, sans-serif" size="1">Rank</font></th>
<th bgcolor="#663300" width="126"><font color="#FFFF00" face="Arial, Helvetica, sans-serif" size="1">Name</font></th>
<th bgcolor="#663300" width="104"><font color="#FFFF00" face="Arial, Helvetica, sans-serif" size="1">Score</font></th>
</tr>
<?
for ($i = 0; $i < $scoresize; $i++)
{
echo ("<tr bgcolor='#669933' align='center'><td><font size='1' face='Arial, Helvetica, sans-serif'>");
echo ($i + 1);
echo ("</font></td><td><font size='1' face='Arial, Helvetica, sans-serif'>");
echo ($tscores[$i][1]);
echo ("</font></td><td><font size='1' face='Arial, Helvetica, sans-serif'>");
echo ($tscores[$i][0]);
echo ("</font></td></tr>");
}
?>
</table>
<?
}
// FLASH DATA CREATED HERE
if ($viewtype == "FLASH")
{
for ($i = 0; $i < $scoresize; $i++)
{
echo ("name" . $i . "=");
echo ($tscores[$i][1]);
echo ("&score" . $i . "=");
echo ($tscores[$i][0]);
echo ("&");
}
}
?>
if I browse to it I get the WARNING: fclose().... thing
If I try to add the echo($filename); at the top I get a parse error.
the thing works like this: (for clarification)
I have root folder(755)>>game folder(755)>>scores folder(755)>>highscores.sco(777)
the html(755) and game.swf(755) are in game folder.
also scores.php (the above code) is in game folder and also (777).
the link in the swf tells scores.php to start doing its thing, and tells it that the global domain is my domain and the .sco is at scores/highscore.sco
All of that is set up exactly the same, and works on the other site. when I copy the files over from the test site to my permanent site everything works but the scores. They stay blank.
Thanks for helping me out (again) Twey
Bookmarks