Login Using Flash MX, PHP, and MySQL

Found this cool tutorial where you can log in to a secret section in a falsh movie using loadVariablesNum and php and mysql to check the user info is ok.

Got it to work fine…
but when i try and use the actionscript/php in a different level/mc of the movie i cant get it to work.

Ive put all the flash code within an mc called logger

this is what i have so far, bearing in mind ive tried allsorts…

so you have a username and password and a submit button, the submit button has this script attached to it:

on (release, keyPress “<Enter>”) {
if (user != “” && pass != “”) {

    status = "Begin Login Process - Wait...";
    loadVariablesNum("http://www.chungking.co.uk/newlogin.php", 0, "POST");
}

}

which is sent off to the PHP page:

//connect to database
if ($user && $pass){
include(‘locked/database.php’);

session_start();
// asign values to session
$_SESSION[username]=$user;

//make query
$query = ("SELECT * FROM phplist_user_user
WHERE email=’{$_POST[‘user’]}’
AND email=(’{$_POST[‘pass’]}’)
") or die (mysql_error());
$result = mysql_query( $query ) or die (“didn’t query”);

//see if there’s an EXACT match
$num = mysql_num_rows( $result );
if ($num == 1){
print “logger.status=welcome $_SESSION[username] You have succesfully logged in&_global.checklog=1”;
} else {
print “logger.status=Sorry, But Your Email Address Did Not Match Our Records In Our Database, Have You Registered?&_global.checklog=2”;
}
}
?>

the print from the php is then sent back to the flash movie and picked up by a status dynamic text field which displays the result:

welcome $_SESSION[username] You have succesfully logged

all works great but cant get the check log bit to work which sends you to frame (1) or (2)

stop();

userinput.restrict=“a-zA-Z0-9-@--.";
Selection.setFocus(userinput);
passinput.restrict="a-zA-Z0-9-@-
-.”;
status=“Enter your information and submit”;
this.onEnterFrame = function () {
_global.checklog;
if(global.checklog == 1){
logger.gotoAndStop(2);
}
if(global.checklog == 2){
logger.gotoAndStop(3);
}
}

tried making the variable checklog global tried changing the php to correspond with the level off the mc.

just cant suss it out

any ideas??

much appreciated.