Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $name = $_GET["name"];
- $scorepos;
- $score = $_GET["score"];
- $valid = $_GET["valid"];
- $mysql_host = "mysql15.000webhost.com";
- $mysql_database = "a4542026_flash";
- $mysql_user = "";
- $mysql_password = "";
- // Connects to your Database
- mysql_connect($mysql_host, $mysql_user, $mysql_password) or die(mysql_error());
- mysql_select_db($mysql_database) or die(mysql_error());
- // Insert regardless of score
- mysql_query("INSERT INTO scores SET name=$name, score=$score");
- // Get all the scores in order
- $result = mysql_query("SELECT * FROM scores ORDER BY score DESC");
- // Placeholder score value
- $score = 0;
- if (mysql_num_rows($result) > 8)
- {
- // Only interested in deleting data if more than 8 values
- // Seek to the eight row in the result
- mysql_data_seek($reslt, 8);
- // Gets the eight row's data
- $row = mysql_fetch_assoc($result);
- // Save the score from the eight player's highscore
- $score = intval($row["score"]);
- // Free the result so we can work on another
- mysql_free_result($result);
- // Delete all players with a lower score than the eight person
- mysql_query("DELETE FROM scores WHERE score<$score");
- }
- mysql_close();
- echo 'thanks,'.$name.'!';
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement