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.ph p)
[code=php]
<?php
$nick = $_POST['Nick'];
$score = $_POST['Score'];
$kills = $_POST['Kills'];
$floor = $_POST['FloorNr'];
$db=mysql_conne ct("")
or die("Couldn't connect.");
mysql_select_db ("databasename" , $db);
mysql_query("IN SERT INTO Table (Nickname,Score ,Kills,Floor) VALUES ('$nick','$scor e','$kills','$f loor')",$db);
mysql_close($db );
echo "Your score has been submited! ";
?>
[/code]
Actionscript:
[code=actionscri pt]
myData = new LoadVars();
myData.Nick = nickname.text;
myData.Score = _global.score;
myData.Kills = _global.TotalKi lls;
myData.FloorNr = _global.floorNr ;
myData.send("su bmitScore.php", myData, "POST");
[/code]
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?
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.ph p)
[code=php]
<?php
$nick = $_POST['Nick'];
$score = $_POST['Score'];
$kills = $_POST['Kills'];
$floor = $_POST['FloorNr'];
$db=mysql_conne ct("")
or die("Couldn't connect.");
mysql_select_db ("databasename" , $db);
mysql_query("IN SERT INTO Table (Nickname,Score ,Kills,Floor) VALUES ('$nick','$scor e','$kills','$f loor')",$db);
mysql_close($db );
echo "Your score has been submited! ";
?>
[/code]
Actionscript:
[code=actionscri pt]
myData = new LoadVars();
myData.Nick = nickname.text;
myData.Score = _global.score;
myData.Kills = _global.TotalKi lls;
myData.FloorNr = _global.floorNr ;
myData.send("su bmitScore.php", myData, "POST");
[/code]
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?
Comment