PDA

View Full Version : Check Login



tripwire
August 6th, 2003, 01:46 PM
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:


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);
}

tripwire
August 6th, 2003, 04:01 PM
Ok, I figured it out. All I had to do was put the if statement inside the checkLogin function.:bu:

tripwire
August 7th, 2003, 01:16 AM
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.

tripwire
August 7th, 2003, 01:56 AM
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.


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

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