Hi!
This has been posted in the flash-forum as well.
I know a solution for this problem and that is using this code:
PHP: (submitScore.php)
-
<?php
-
$nick = $_POST['Nick'];
-
$score = $_POST['Score'];
-
$kills = $_POST['Kills'];
-
$floor = $_POST['FloorNr'];
-
-
$db=mysql_connect("")
-
or die("Couldn't connect.");
-
mysql_select_db("databasename", $db);
-
-
mysql_query("INSERT INTO Table (Nickname,Score,Kills,Floor) VALUES ('$nick','$score','$kills','$floor')",$db);
-
-
mysql_close($db);
-
echo "Your score has been submited! ";
-
?>
-
Actionscript:
-
myData = new LoadVars();
-
myData.Nick = nickname.text;
-
myData.Score = _global.score;
-
myData.Kills = _global.TotalKills;
-
myData.FloorNr = _global.floorNr;
-
-
myData.send("submitScore.php", myData, "POST");
-
The problem with this is that submitScore.php pops up in the browser so that
the player can just refresh the submitScore.php page and in such a way
repeat the insert query to the database, adding the score several times.
Either I can make the page close down on its own or is there a way to insert a
value to a database without making the submitScore.php pup up and accessible
to the user?