Shooter Posted September 6, 2008 Share Posted September 6, 2008 Hi Everyone,I have a little problem. I have a flash login in an header and for some reason it does not work at all. It keeps saying that "you have the wrong username/password" even if your login information are okay.Here is the flash code.. on (release){ var _loc4 = "login_flash.php"; var _loc3 = new LoadVars(); var _loc2 = new LoadVars(); _loc3.onclick = function (success) { if (success) { if (this.error == "none") { trace ("Everything\'s okay!"); getURL("index.php"); } else { trace ("Something went wrong"); trace (_loc2); getURL("index.php?act=login&error=true"); } // end else if } else { trace ("Error connecting to server."); getURL("index.php?act=login&error=true"); } // end else if }; _loc2.loginusername = _root.login.uname.text; _loc2.loginpassword = _root.login.passw.text; _loc2.sendAndLoad(_loc4, _loc3, "POST");}on (rollOver){ gotoAndPlay(2);}on (rollOut){ gotoAndPlay(11);} If you have any ideas why, please let me know.(I'm not the person who did this code, I'm not able to reach him so I figured I would ask here.)Thanks. Link to comment Share on other sites More sharing options...
SuperRoach Posted September 8, 2008 Share Posted September 8, 2008 To help you better, do you have a link to the site its at, or the forums it's tying in to? I'm not sure if firebug catches flash, but you can use that to see what your posting to the next page, to see if it matches up with the equivlant html login. Link to comment Share on other sites More sharing options...
justsomeguy Posted September 8, 2008 Share Posted September 8, 2008 It redirects on two occasions to say there's an error, do you know which of those it is doing? If you're testing this live where trace statements aren't going to work then add another parameter to the URL so you can see if it's redirecting because it couldn't contact the server or because the error variable was set. Link to comment Share on other sites More sharing options...
Shooter Posted September 8, 2008 Author Share Posted September 8, 2008 I am not an expert in FLASH, like I said I'm not the person who did this code. I tried to add some stuff like you said, but... the "GO" button does not work anymore.Here is the link to the website. np.validns.com Link to comment Share on other sites More sharing options...
justsomeguy Posted September 9, 2008 Share Posted September 9, 2008 Just add something to the end of the URL that it's redirecting to. e.g.:getURL("index.php?act=login&error=true&badpass");getURL("index.php?act=login&error=true&noconnect");for the first and second redirects. When the page redirects you can look at the URL to figure out which redirect it used. Link to comment Share on other sites More sharing options...
Shooter Posted September 9, 2008 Author Share Posted September 9, 2008 It brings me to this : http://np.validns.com/index.php?act=login&...rue&badpass on (release){ var _loc4 = "login_flash.php"; var _loc3 = new LoadVars(); var _loc2 = new LoadVars(); _loc3.onLoad = function (success) { if (success) { if (this.error == "none") { trace ("Everything\'s okay!"); getURL("index.php"); } else { trace ("Something went wrong"); trace (_loc2); getURL("index.php?act=login&error=true&badpass"); } // end else if } else { trace ("Error connecting to server."); getURL("index.php?act=login&error=true&noconnect"); } // end else if }; _loc2.loginusername = _root.login.uname.text; _loc2.loginpassword = _root.login.passw.text; _loc2.sendAndLoad(_loc4, _loc3, "POST");}on (rollOver){ gotoAndPlay(2);}on (rollOut){ gotoAndPlay(11);} Link to comment Share on other sites More sharing options...
justsomeguy Posted September 9, 2008 Share Posted September 9, 2008 It will redirect there if this.error does not equal "none", so you'll probably want to print this.error to see what it is. If you need to, you can add a dynamic text field and use that as debug output. You write to a dynamic text field using its text property.dyn_text.text = this.error; Link to comment Share on other sites More sharing options...
Shooter Posted September 9, 2008 Author Share Posted September 9, 2008 How do you add a box? I'm not very familiar with flash :S Link to comment Share on other sites More sharing options...
justsomeguy Posted September 9, 2008 Share Posted September 9, 2008 There is a toolbar on the left that contains a text box tool, so you draw a textbox out and set whatever text options you want on the bottom in the properties panel. Change the type to Dynamic, and give the text box a unique name in the instance name box. You refer to the textbox in the code with the instance name. e.g. if you call the box "dyn_text" then you use this:dyn_text.text = this.error;You might have to play around to get the scope right, so instead of writing just the error message also write some plain text to make sure that you can write to the text field in the first place.dyn_text.text = "Error text:\n";dyn_text.text += this.error; Link to comment Share on other sites More sharing options...
Shooter Posted September 11, 2008 Author Share Posted September 11, 2008 As you can see on "np.validns.com" I added the box and everything.Here is the code. on (release){ var _loc4 = "login_flash.php"; var _loc3 = new LoadVars(); var _loc2 = new LoadVars(); _loc3.onLoad = function (success) { if (success) { if (this.error == "none") { trace ("Everything\'s okay!"); getURL("index.php"); } else { trace ("Something went wrong"); trace (_loc2); getURL("index.php?act=login&error=true"); dyn_text.text += this.error; } // end else if } else { trace ("Error connecting to server."); getURL("index.php?act=login&error=true"); } // end else if }; _loc2.loginusername = _root.login.uname.text; _loc2.loginpassword = _root.login.passw.text; _loc2.sendAndLoad(_loc4, _loc3, "POST");}on (rollOver){ gotoAndPlay(2);}on (rollOut){ gotoAndPlay(11);} The text does not change! Did I do something wrong? Link to comment Share on other sites More sharing options...
justsomeguy Posted September 11, 2008 Share Posted September 11, 2008 It's probably not finding the text box. If you're editing Actionscript, in the Actionscript window there's a button with a crosshair on it. If you click that you can browse to find your text box, and check the Absolute radio button to put in the absolute path to the text box. The code probably isn't finding an object called dyn_text in the scope that it's looking. The absolute name will be something like _root.dyn_text. Also make sure that the text box has "dyn_text" as the instance name. Link to comment Share on other sites More sharing options...
Shooter Posted September 11, 2008 Author Share Posted September 11, 2008 Okay, Thanks for you help. I did what you say and it says "Not ok".. I'm guessing it is in the php file? Link to comment Share on other sites More sharing options...
justsomeguy Posted September 11, 2008 Share Posted September 11, 2008 That message is coming from the PHP file, you would need to look at the code in there to figure out what condition causes that message to be sent. Link to comment Share on other sites More sharing options...
Shooter Posted September 11, 2008 Author Share Posted September 11, 2008 Where can I see what the flash file sends to the .php file? Link to comment Share on other sites More sharing options...
justsomeguy Posted September 12, 2008 Share Posted September 12, 2008 In PHP, you can use print_r($_POST). If the PHP page doesn't actually show up in a browser, you would need to use file_put_contents to write it to a file and then look at the file.file_put_contents('debug.txt', print_r($_POST, true));You can also use a debugger like Firebug to look at the actual request going out and the response that comes back. Link to comment Share on other sites More sharing options...
Shooter Posted September 12, 2008 Author Share Posted September 12, 2008 The PHP code is fine, I'm 99.9% sure that the "header" does not send the good things, could it be that? Link to comment Share on other sites More sharing options...
justsomeguy Posted September 12, 2008 Share Posted September 12, 2008 Well I guess, I guess it could be anything. That's why you use something like PHP or Firebug to print all of the data out so you can look at it and figure out if it's a problem or not. With PHP you can print $_POST, $_GET, $_SESSION, $_COOKIE, $_SERVER etc to see what information PHP is using. If you use Firebug you can also see all of the HTTP headers, the $_SERVER array only contains certain headers. I'm not telling you that the PHP code is wrong, but you asked how to look at the information that got submitted and printing that information out in PHP is the way I normally use. You can use whatever method you want. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.