A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: [F8] Random retrieved from POST

Threaded View

  1. #1
    Junior Member
    Join Date
    Aug 2008
    Posts
    8

    Unhappy [F8] Random retrieved from POST

    Hi guys i have this flash form which simply sends a inputted username and password to a PHP page which tests only if the username exists at the moment in the database and then the PHP sends a response back to flash to say either yes or no and then flash puts it in the errormsg display.

    Now what i am experiencing is that the PHP page that pops up always says &login=YES& when i put in the right username but flash sometimes gets a yes but sometimes gets a &login=NO& and even sometimes a undefined :S when nothing has changed ??

    Please ignore the Age Dropdown on the form i keep meaning to remove it so it has no bearing on the POST.

    The white textarea that displays some traced out var information on the right hand side i hope will be useful to someone inhelping me resolve this....

    Username on form is Admin password can be anything as the PHP only checks for the username at the moment.

    Working URL link here to fully experience this randomness.. http://crms.no-ip.info/flash

    Sorry for the long post guys but im at my wits end with this......

    ActionScript here :
    Code:
    	stop();
    	///PHP PROCESSING LOGIN PAGE ADDRESS
    	var WebAddress:String ="http://localhost/flash/functions/login.php";
    	//Result var contains the retrieved info from PHP file.
    	//var Result = new LoadVars(); 
    	var Age:Number
    	var Username:String
    	var Userpassword:String
    
    for(var i:Number = 1; i<100; i++){
    	age.addItem(i);
    }
    	
    
    myBtn_btn.onRelease = function() {
    	 Age = age.selectedIndex+1;
    	 Username = username.text;
    	 Userpassword = userpass.text;
    	trace("You are "+Age+" years old and Your username is "+Username+ " And your password is " +Userpassword);
     	//Open page to display the information using GET because testing in the development.
    	getURL(WebAddress,"_blank","POST");
    			////////COPY/PASTEMODIFICATION FROM WEBSITE TEST CODE///////////
    
    					// here is a reference to this timeline
    var here = this
    // create an object to store the variables
    varReceiver = new LoadVars();
    // load a file
    varReceiver.load("http://localhost/flash/functions/login.php");
    // when the variables finish loading
    //trigger something
    varReceiver.onLoad = function() {
    		
    	// show some text in a text field
    	// using the loaded variables
    	//here.createTextField("t_txt", 1, 100, 100, 1, 1);
    	//here.t_txt.autoSize = true;
    	
    	//here.t_txt.text = "My first name is " + this.fName + ".\n";
    	//here.t_txt.text += "My last name is " + this.lName + ".\n";
    	//here.t_txt.text += "I'm " + this.age + " years old.";
    	errormsg.text = this.login;
    	//trace(VarReceiver);
    	myTrace.text = varReceiver;
    	};
    
    			////////////END TEST CODE///////////////
                            /////MY HAND CODED FUNCTION WHICH I COULD NOT GET TO WORK////
    			//Result.onLoad = function (success){
    			//if(success){
    				//trace("Result : "+this.Result);
    				//trace("Variables Loaded");
    				//errormsg.text += Result;
    			//}else{
    				//trace("Error loading page");
    			//}
    	///}
    	///Result.load(WebAddress);
    }
    The PHP code :
    PHP Code:
    $login ="";
    $Username ucfirst($_POST['Username']);
    $Userpassword md5($_POST['Userpassword']);

    //Search for user in DB 
    $sql = ("SELECT * FROM `users` WHERE `Username` = '".$Username."'");
    $query mysql_query($sql);
        
    $result mysql_fetch_array($query);
        if(
    $result == ""){
            
    $login "NO";
            echo 
    $result;
            }else{
            
    //write back to flash YES user is registered
            
    $login "YES";
            
    ///////
            

    Please can someone help me with this its almost 2 days of trying to get a simple send and receive from Flash/PHP going , I am considering of giving up on Flash completely.... As even the most simplest of tasks seems like a impossible task.....

    Many many thanks for those of you who take the time out to read and respond to this epic post.

    Regards Pinky.
    Last edited by Pinkmischief; 08-02-2008 at 12:38 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center