SitePoint Enthusiast
can anyone tell me what's going on here?
i've made a game in flash
http://www.flash-i.com/supersheep/plat2.html
it has three variables:
my_score
my_name
my_mail
>>>> play the game - then click on next stage. (at the moment - this takes you to the 'scores' page ('cause it's still in development of course
at this page a table of results should show up but this is all you see:
$my_name: $my_score"; echo "
"; } ?>
------------------------
i'm using two bits of php supplied by a friend:
1st is:
<?php
$num_to_show = "15";
$file = "log.dat";
$list = file($file);
$list[] = "$my_score|$my_name|$email";
natcasesort($list);
$res = array_reverse($list);
$fp = fopen($file, "w+");
for($x=0; $x <= $num_to_show; $x++){
fputs($fp, "$res[$x]\r\n");
}
fclose($fp);
?>
which is stored in the same directory as the flash game and is named log.dat and contains nothing on the page (no html or anything) except the above code.
2nd is:
<?php
$file = "log.dat";
$list = file($file);
natcasesort($list);
$res = array_reverse($list);
echo "<ol><b>High Scores</b>";
foreach($res as $temp){
$check = explode("|", $temp);
$score = trim($temp[0]);
$name = ucwords(trim($temp[1]));
$email = trim($temp[2]);
echo "<li><b><a href=\"mailto:$my_email\">$my_name</a>: $my_score</b></li>";
echo "</ol>";
}
?>
which is in a normal html file, also stored in same directory as flash game.
any ideas what's going wrong -
is it even getting the data from the flash game at all...
please let me know php gurus, and i'll be eternally greatfull
kind regards,
jeev
SitePoint Enthusiast
why don't your files have .php extensions?
SitePoint Enthusiast
hi
first of all thanks for the quick reply....
i've never worked with php before so don't have an idea of even the basics ... could you maybe exlpain a litlle further please?
thanks,
jeev
If you're just keeping a bit of data in the log.dat file, the extension doesn't matter. The only pages that MUST have .php extensions are files with PHP code inside that needs to be processed.
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Bookmarks