Jump to content

Flash games with high scores


aksd

Recommended Posts

hi all

i've put neave snake on my site, and i want to be able to keep the highscores

i've decompiled the flash game and i found this script (i'll upload it somwhere else if needed)

and i found out that the game sends the scores to games_score.php wich sends them to a txt file.

this is the data that is sent to games_score.php : game=snake3&url=http%3A%2F%2Fwww%2Eneave%2Ecom%2Fgames%2Fsnake%2Fsnake%2Eswf&name=somename&score=195

what do i have to write in games_score.php to work ?

please, help me

thnks!

Link to comment
https://forums.phpfreaks.com/topic/48933-flash-games-with-high-scores/
Share on other sites

This code only works if you only store the highest score, not if you want a list if i.e. the ten highest scores. However, this script might help you further...

 

if(isset($_GET) {
  $score= $_GET['score'];
  $username = $_GET['name'];

  $file = "http://localhost/test/highscore.txt"; //contains i.e. "Username,Highscore";
  $fh = fopen($file, "r");
  $content = fread($file);
  fclose($fh);

  $content = explode(",",$content);
  $highScore = $content[1];
  if($score > $highScore) {
     $fh = fopen($file, "w");
     $newContent = $username.",".$score;
     fwrite($fh, $newContent);
     fclose($fh); 
}

i have progressed a little :D

i found this script http://rapidshare.com/files/28477013/highscoresss.zip , and modified it a little, and now the scores are writing in the database, but i don't know how to display them in the game. i know i have to write in games_score.php some code from loadscores.php (from the archive) but i don't know exactly what

thanks!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.