Hi,
I’m trying to set up a flash login using php and mysql…
(my host is Media Temple)
in my flash i have the login_btn:
on (press) {
dbpassword = "password";
username = "username";
user = forms.user.text;
pass = forms.pass.text;
loadVariablesNum("login.php", "0", "POST");
gotoAndPlay(2);
}
}
then in the next frame i have an onEnterFrame statement that displays something when _root.checklog == 1.
login.php is in the same folder as the swf calling it.
the login.php is as follows:
<?php
$user = $_POST['user'];
$pass = $_POST['pass'];
$username = $_POST['username'];
$password = $_POST['dbpassword'];
$dbc = mysql_pconnect("localhost",$username,$password);
mysql_select_db("user", $dbc);
$query = "SELECT * FROM user WHERE nick = '$user' AND pass = PASSWORD('$pass')";
$result = mysql_query( $query );
$num = mysql_num_rows( $result );
if ($num == 1){
echo "checklog=1";
} else {
echo "checklog=2";
}
?>
Now, my problem is that either the php doesn’t communicate with mysql, or it doesn’t send data back to flash, or flash is not handling the php in a right way…
i checked the query and it displays proper results when using sql…
can someone help me out solving this one…
many thanks