On my game, I have a high score submit script. It is all done on a file on my website(So this is kind of a PHP + AS2 problem, but moreso AS2). When the game is hosted on my website, the high score submit works fine. But when it is hosted on any other website, it doesn't work. This is the AS2 code:
ActionScript Code:
on (release) {
System.security.allowDomain("mywebsite");
lvOut = new LoadVars();
uscore = new LoadVars();
uscore.name = _root.suname;
uscore.score = _root.suscore.stime;
uscore.game = "alien";
uscore.mode = "survival";
uscore.password = "password";
_root.play();
uscore.onLoad = function(success)
{
if(success)
{
_root.play();
}
else
{
_root.connecterror.play();
}
}
uscore.sendAndLoad("mywebsite/highscoresubmit.php",lvOut,"POST ");
}
And this is the php for highscoresubmit.php:
PHP Code:
$game=$_POST['game'];
$name=$_POST['name'];
$mode=$_POST['mode'];
$score=$_POST['score'];
$password=$_POST['password'];
$game=mysql_real_escape_string($game);
$name=mysql_real_escape_string($name);
$mode=mysql_real_escape_string($mode);
$score=mysql_real_escape_string($score);
if($password=="password")
{
mysql_query("INSERT INTO scores(game, name, score, mode) VALUES('$game', '$name', '$score', '$mode')");
}
else
{
header('Location:notfound.php');
}
As I said, this works fine if the game is hosted on my wesbite, but doesn't when it is anywhere else. What do I need to change in the AS2 to fix this?
Thank you in advance,
Xyphon.