Simple flash php authen

here is what i wanna do… i want to have a log in… for my flash file… its got a username field and password field… on submit… it sends the variables of 2 fields to a .php file… which checks if the user name and password match the user name and password in the .php file… it it does… it returns a varaible to the flash file…

here is what my php file is like…

<?php

$pass = $_POST['pass'];
$user = $_POST['user'];

//correct username and password ...

$orguser = "jazzman121";
$orgpassw = "test";


if ($passw==$orgpassw&$user==$orguser) {
	$result = "ACCESS GRANTED";	
}else {		
	$result = "ACCESS DENIED";
}
?>

im kinda new to php… so this code might not be right… i guess thats why its not working :sure:

anyways… how should my flash file look like?? please help

thanks… (if i have to change my php… please let me know about that too… )

Im thinking this should be safe… since its serverside soo no one can find out the correct username and password… …

and i dont have a database… soo i cant do that … :frowning: ( if there are other better ways to do this… please let me know thanks )

PHP file:


<?php

$pass = $_POST['pass'];
$user = $_POST['user'];

//correct username and password ...

$orguser = "jazzman121";
$orgpass = "test";


if ($pass == $orgpassw && $user == $orguser) 
{
    echo "result=ACCESS GRANTED";    
}
else 
{        
    echo "result=ACCESS DENIED";
}
?>

FLASH:

You need to create a loop to check for the variable and make sure that its not empty. This is MX code since you didn’t specify which version you are using…


_root.onEnterFrame = function(){
if(result == ""){
loadVariablesNum("phpPage.php", 0, "post");
}
else if(result == "ACCESS GRANTED"){
//do something correct here....
}
else if(result == "ACCESS DENIED"){
//Send them away here....
}
}

something like that should work. I didn’t check tho…