Check Login

I have a login page that checks the users login name and password against a mysql database. Now I’m having a simple problem that I can’t seem to figure out. ONce the user has entered in a successful name and password I want to move to another frame. I’m doing this by using a print command from php that registers a CheckLog=1 variable. Now how would I go about checking this CheckLog variable to see if it equals 1.

Here is what I have so far on frame 2:

[AS]
var myLoginVars = new LoadVars();
myButton.onRelease = function() {
if (!name.length) {
loginT = “Please Enter your name”;
}
else if (!pass.length) {
loginT = “Please Enter your password”;
}
else {
myLoginVars.name = name;
myLoginVars.pass = pass;
myLoginVars.sendAndLoad(“login.php”, myLoginVars, “POST”);
myLoginVars.onLoad = checkLogin;
loginT = “Sending…”;
}

}
function checkLogin() {
trace (this);
loginT = myLoginVars.retVal;

}

if (CheckLog ne “”) {
gotoAndPlay (5);
} else {
gotoAndPlay (2);
}

[/AS]

Ok, I figured it out. All I had to do was put the if statement inside the checkLogin function.:bu:

Actually I just realized that doesn’t work, because now the user is logged in even when their login and password is wrong. The CheckLog variable needs to be checked from somewhere else I guess.

Ok I tried putting the if statement inside another function which is read from the checkLogin function, but now when I get the login and password correct it doesn’t move from the current frame. This is driving me crazy… does anyone have any suggestions.

[AS]
function checkLogin() {
trace (this);
loginT = myLoginVars.retVal;
myLoginVars.onLoad = checkLogged;
}

function checkLogged() {
if (CheckLog ne “”) {
gotoAndPlay (5);
} else {
gotoAndPlay (2);
}
}

[/AS]