OK, I am trying to do my first simple user authentication for a test built in Flash. I’m just checking to see if someone with the same name and email exists in the mySQL database and then echoing out entryAllowed=false if they exist.
PHP Code:
//query is successful and these vars trace out in flash
$visitCheck = mysql_query("SELECT entryAllowed,firstName,lastName FROM table WHERE firstName='$postVars_firstName' AND lastName='$postVars_lastName' AND email='$postVars_email' ORDER BY lastName");
while ($row = mysql_fetch_assoc($visitCheck)) {
foreach($row as $key => $value){
echo '&'.$key.' = '.$value.'&';
}
}
Then in Flash…
AS 2.0 Code:
var recordStatus:LoadVars = new LoadVars();
recordStatus._parent = this;
recordStatus.onLoad = function(success){
removeMovieClip(this._parent.sendingHolder_mc);
trace("recordStatus onLoad");
if(success){
for(x in this){
//THIS TRACES OUT THE VARS ECHOED FROM PHP!!
trace(x+"="+this[x]);
}
trace("record check successful");
//THESE ARE ALL UNDEFINED!!
trace("this.entryAllowed = "+this.entryAllowed);
trace("this.firstName = "+this.firstName);
trace("this.lastName = "+this.lastName);
if(this.entryAllowed != "false"){
//allow entry
}else{
//don't allow entry
}
}
}
The AS traces out:
recordStatus onLoad
lastName = close
firstName = mike
entryAllowed = false
onLoad=[type Function]
_parent=_level0.loginHolder_mc.login_mc
record check successful
this.entryAllowed = undefined
this.firstName = undefined
this.lastName = undefined
entry was allowed by record check
I’ve tried banging my head against the keyboard but that didn’t work. Any help would be greatly appreciated!!!
-mike