I want to do a small autentification script to practise.
I got 2 input boxes in the flash script , user ans pass.
I added one button that have the following code:
on (release, keyPress "<Enter>") {
if (user != "" && pass != "") {
status="Connecting...please wait...";
loadVariablesNum("login.php", 0, "POST");
}
}
The user input box have Var=user And Instance name userinput.
The pass input box have Var=pass And Instance name passinput.
I also added under this one Dynamic text box having Var=status
The php page looks like this :
login.php
<?
$user=$_POST['user'];
$pass=$_POST['pass'];
if ($user && $pass){
mysql_connect("localhost","root","q99st") or die ("status=Impossible to connect to database.");
mysql_select_db("neo_flashtest") or die ("status=Cannot select base.");
//make query
$query = "SELECT * FROM users WHERE user = '$user' AND pass = '$pass'";
$result = mysql_query( $query ) or die ("status=Query Error.");
$num = mysql_num_rows( $result );
if ($num == 1){
print "status=You are now connected";
} else {
print "status=Bad login or pass";
}
}
?>
If I put a simple echo "status=test"; , withotu any user checkig, the word test appears on my flash script. What may be bad with my code?
(I saw that the variable user doesn't pass from the flash script to the php page....
I got 2 input boxes in the flash script , user ans pass.
I added one button that have the following code:
on (release, keyPress "<Enter>") {
if (user != "" && pass != "") {
status="Connecting...please wait...";
loadVariablesNum("login.php", 0, "POST");
}
}
The user input box have Var=user And Instance name userinput.
The pass input box have Var=pass And Instance name passinput.
I also added under this one Dynamic text box having Var=status
The php page looks like this :
login.php
<?
$user=$_POST['user'];
$pass=$_POST['pass'];
if ($user && $pass){
mysql_connect("localhost","root","q99st") or die ("status=Impossible to connect to database.");
mysql_select_db("neo_flashtest") or die ("status=Cannot select base.");
//make query
$query = "SELECT * FROM users WHERE user = '$user' AND pass = '$pass'";
$result = mysql_query( $query ) or die ("status=Query Error.");
$num = mysql_num_rows( $result );
if ($num == 1){
print "status=You are now connected";
} else {
print "status=Bad login or pass";
}
}
?>
If I put a simple echo "status=test"; , withotu any user checkig, the word test appears on my flash script. What may be bad with my code?
(I saw that the variable user doesn't pass from the flash script to the php page....