Jump to content

Transfer vars from Flash(AS2) to PHP


Xyphon

Recommended Posts

Sorry if this isn't the right forum, I wasn't sure where to post this. Alright, so I have a high score submit script, and it goes as follows...

 

This is the actionscript:

on (release) {
var uscore:LoadVars = new LoadVars();
uscore.name = _root.suname;
uscore.score = _root.suscore.stime;
uscore.game = "alien";
uscore.mode = "survival";
uscore.sendAndLoad("linkhere", uscore, "POST");
play();
} 

Note: We have also tried:

on (release) {
var uscore:LoadVars = new LoadVars();
uscore.name = _root.suname;
uscore.score = _root.suscore.stime;
uscore.game = "alien";
uscore.mode = "survival";
var uscoresubmit:LoadVars = new LoadVars();
uscore.sendAndLoad("linkhere", uscoresubmit, "POST");
play();
} 

 

The PHP is:

<?PHP
include('Connect.php');
$name=$_POST['name'];
$name=mysql_real_escape_string($name);
$score=$_POST['score'];
$score=mysql_real_escape_string($score);
$game=$_POST['game'];
$game=mysql_real_escape_string($game);
$mode=$_POST['mode'];
$mode=mysql_real_escape_string($mode);
if(!empty($game))
{
mysql_query("INSERT INTO scores(game, name, score, mode) VALUES ('$game', '$name', '$score', '$mode')");
}
?> 

I have also tried running a number of things on the "else" of that if(!empty($game)) and nothing has pulled through, so I'm under the notion that it isn't loading the page in sendAndLoad()?

 

It was working before, but it appears to have just stopped, we're not sure what we changed.

 

Any help would be greatly appreciated!

Thanks,

Xyphon

Link to comment
https://forums.phpfreaks.com/topic/226310-transfer-vars-from-flashas2-to-php/
Share on other sites

The PHP is most definitely working, I've tried just running the script without the variables and it works, so if the variables were null it should still create an empty table. It seems to not be loading in the "sendandLoad", although I'm not positive that this is the problem. It has worked twice before, we have made minor changes since but nothing that should disable it from working properly.

I'm pretty sure it's the as2 now, because I changed the as2 so that it would check if it successfully sent the vars. The first time we tried it, it successfully sent it, and then after that it never worked again. I guess this is an as2 question now, so it really doesn't belong in this forum, unless it really is the PHPs fault, which I doubt.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.