Page 1 of 1

php redirect using flash

Posted: Fri May 26, 2006 10:44 am
by Citizen
I have a swf game that when it reaches gameover it executes the below actionscipt code and should redirect the page to arcade.php.

Code: Select all

// HERE THE ARCADE SESSION IS INITIATED
// DON'T FORGET TO CHANGE THE GAMENAME VALUE!
if (this.sessionstarted != 1) {
   this.arcade = new LoadVars();
   this.sessionvars = new LoadVars();
   this.arcade.gamename = "towerball";
   this.arcade.sessdo = "sessionstart";
   this.arcade.sendAndLoad("arcade.php", sessionvars, "POST");
   this.sessionstarted = 1;
}

// IF GAMEOVER=1, SUBMIT THE SCORE AND REDIRECT THE PAGE
if (_root.gameover == 1) {
   if ((this.askpermission != 1) && (this.sessionvars.connStatus == 1)) {
      this.prequestvars = new LoadVars();
      this.pranswer = new LoadVars();
      this.prequestvars.gametime = this.sessionvars.gametime;
      this.prequestvars.fakekey = this.sessionvars.initbar;
      if (_root.score == 0) {
         this.prequestvars.score = -1;
      } else {
         this.prequestvars.score = _root.score;
      }
      this.prequestvars.id = this.sessionvars.lastid;
      this.prequestvars.sessdo = "permrequest";
      this.prequestvars.note = (this.prequestvars.id*this.prequestvars.score*this.prequestvars.fakekey);
      this.prequestvars.sendAndLoad("./arcade.php", this.pranswer, "POST");
      this.askpermission = 1;
   }
   if ((this.pranswer.validate == 1) && (this.finalsent != 1)) {
      this.burnscore = new LoadVars();
      this.burnscore.microone = this.pranswer.microone;
      this.burnscore.gametime = this.prequestvars.gametime;
      this.burnscore.id = this.prequestvars.id;
      if (_root.score == 0) {
         this.burnscore.noscore = 1;
      }
      this.burnscore.sessdo = "burn";
      this.burnscore.send("./arcade.php", "_self", "POST");
      this.finalsent = 1;
   }
}
I cant change the swf code, but I do know it works becuase it works on other arcades. I must make my arcade code compatable with the game.

I have the rest of the arcade script done, but I dont know where to start with the variables being sent by the game and how to achieve the redirect using this code.

Posted: Mon May 29, 2006 10:53 am
by Citizen
Any help on this? I'd be willing to paypal $10 to the person that helps me fix this.

Posted: Mon May 29, 2006 2:56 pm
by Citizen
Anyone please?

If noone here knows what I need to do, can you direct me to a different forum that would?

Posted: Mon May 29, 2006 4:18 pm
by ianhull
// IF GAMEOVER=1, SUBMIT THE SCORE AND REDIRECT THE PAGE

This code will send the variables to php

this.burnscore.send("./arcade.php", "_self", "POST");
after this place

getURL("yourpage.php", "_self");
this way your variables have been sent and you then redirect to the page.

Posted: Tue May 30, 2006 12:42 pm
by Citizen
Thats not the problem.

I cant change the actionscript code nor am i the one that made it. I have to make my php arcade script compatable with that code in the swf, which is hardwired into every game that would run on my arcade.

I've coded everything in my php arcade except for the part that receives the score. Thats what I need help with.