# Check Login

**URL:** https://forum.kirupa.com/t/check-login/27792
**Category:** flash
**Created:** [August 6, 2003, 5:46pm UTC](https://forum.kirupa.com/t/check-login/27792 "2003-08-06T17:46:23Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![tripwire](https://avatars.discourse-cdn.com/v4/letter/t/ccd318/32.png) [@tripwire](https://forum.kirupa.com/u/tripwire)
#### Post date: [August 6, 2003, 5:46pm UTC](https://forum.kirupa.com/t/check-login/27792/1 "2003-08-06T17:46:23Z")

</div>

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]

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 6, 2003, 8:01pm UTC](https://forum.kirupa.com/t/check-login/27792/2 "2003-08-06T20:01:54Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 7, 2003, 5:16am UTC](https://forum.kirupa.com/t/check-login/27792/3 "2003-08-07T05:16:10Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 7, 2003, 5:56am UTC](https://forum.kirupa.com/t/check-login/27792/4 "2003-08-07T05:56:44Z")

</div>

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]
