aksd Posted April 27, 2007 Share Posted April 27, 2007 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 More sharing options...
nikkieijpen Posted April 27, 2007 Share Posted April 27, 2007 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); } Link to comment https://forums.phpfreaks.com/topic/48933-flash-games-with-high-scores/#findComment-239781 Share on other sites More sharing options...
aksd Posted April 27, 2007 Author Share Posted April 27, 2007 thanks A LOT for trying to help me! you're the first i wrote that in games_score.php, but it doesn't work it doesnt't write anything to highscore.txt Link to comment https://forums.phpfreaks.com/topic/48933-flash-games-with-high-scores/#findComment-239878 Share on other sites More sharing options...
aksd Posted April 29, 2007 Author Share Posted April 29, 2007 i have progressed a little 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! Link to comment https://forums.phpfreaks.com/topic/48933-flash-games-with-high-scores/#findComment-240798 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.