";
echo "
SameGame High Scores";
if($score > 0){#Sending in a new high score
$name = $_POST["name"];
$grid = $_POST["gridSize"];
$time = $_POST["time"];
if($name == "")
$name = "Anonymous";
//if($grid != "10x10"){
//Need a standard, so as to reject others?
//}
$file = fopen("score_data.xml", "a"); #It's XML. Happy?
$ret = fwrite($file, "". $score . ""
. $name . "" . $grid . ""
. $time . "\n");
echo "Your score has been recorded. Thanks for playing!";
if($ret == False)
echo "
There was an error though, so don't expect to see that score again.";
}else{#Read high score list
#Now uses XSLT to display. So just print the file. With XML cruft added.
#Note that firefox at least won't apply the XSLT on a php file. So redirecting
$file = fopen("scores.xml", "w");
$ret = fwrite($file, '' . "\n"
. '' . "\n"
. "\n" . file_get_contents("score_data.xml") . "\n");
if($ret == False)
echo "There was an internal error. Sorry.";
else
echo '';
}
echo "