Jump to content

Flash to PHP interaction


ILYAS415

Recommended Posts

Okay ive been playing around with a flash game which i created.

The game is integrated into an arcade for a text-based game.

 

Okay basically im trying to get the end scores for the game and send them to a php script.

The php script is then meant to process the score and see if the player is worthy enough to be credited money in the actual text-based game.

 

Heres the code which is meant to send information to the php script:

_root.finalscore=_root.score;

var receiver_lv:LoadVars = new LoadVars();
receiver_lv.onLoad = function(ok){
      if(ok){
           message.text = receiver_lv.message;
	   score = _root.score;
	   getURL("flashtophp1.php", this, "POST");
      }else{
           message.text = "There was an error!!";
      }
}
receiver_lv.load("flashtophp1.php");

 

Okay and heres the php script which then processes it:

<?
$username= $_SESSION['username'];

$score= $_POST['score'];
//OKAY THE PROBLEM IS THAT THE SCRIPT READS THE POST VAR AS EMPTY
if ($score < "100"){
$msg="You need 100 to win a prize! your score was $score $username";
}else{
$money= $score*5;
$msg="You earned £$money ".ucfirst($username)."";
mysql_query("UPDATE users SET money=money+'$money' WHERE username='$username'");
}

echo "&message=$msg $score";
?>

Well the problem is that the $_POST['score'] var is empty.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.