micmac
05-22-2002, 05:54 AM
Hi Guys,
I'm creating a login area which utilises Flash/PHP/mySQL.
When the user puts in a name and presses the login button a php script is executed. This checks the database for the name typed in by the user. This works fine if the name does exist in the database and the user is taken to the correct frame.
However, if the user types in a name that is not in the database a dynamic text field sends a message from that php script stating that the name could not be found.
This appears on the second frame.
The problem is that when the user is in this frame you can't type in a value (login name), because the frame is looping.
Here is a rundown of my frames:
Frames 1,2 and 3 all contain the text input field called "Name", the dynamic text field called "Status" and the login button. The button contains the following script:
on (release) {
if (Name ne "") {
gotoAndPlay (2);
Status = "Beginning Login Process.. Please Hold";
// The next line calls the login_flash.php script. And returns the results from it to the movie.
loadVariablesNum ("login_flash.php?Name="+Name, "0");
} else {
Status = "Please enter a User Name";
}
}
Frame 1 has a stop()
Frame 2 and 3 have this code:
if (CheckLog ne "") {
gotoAndPlay (4);
} else {
gotoAndPlay (1);
}
Frame 4 is the frame the user sees if their name was in the database.
And the PHP script is:
<?
require 'include.php';
$Name = strtoupper ($Name);
$Name = ereg_replace("[^A-Za-z0-9 ]", "", $Name);
mysql_connect($DBhost,$DBuser,$DBpass);
mysql_select_db("$DBName");
$query = "SELECT * FROM $table WHERE Name = '$Name'";
$result = mysql_query($query);
$numR = mysql_num_rows($result);
if ($numR == 1) {
print "Status=Success Login Complete&CheckLog=1";
}
else {
print "Status=Failure - Your name was not found - Please register";
}
?>
Any ideas?
I'm creating a login area which utilises Flash/PHP/mySQL.
When the user puts in a name and presses the login button a php script is executed. This checks the database for the name typed in by the user. This works fine if the name does exist in the database and the user is taken to the correct frame.
However, if the user types in a name that is not in the database a dynamic text field sends a message from that php script stating that the name could not be found.
This appears on the second frame.
The problem is that when the user is in this frame you can't type in a value (login name), because the frame is looping.
Here is a rundown of my frames:
Frames 1,2 and 3 all contain the text input field called "Name", the dynamic text field called "Status" and the login button. The button contains the following script:
on (release) {
if (Name ne "") {
gotoAndPlay (2);
Status = "Beginning Login Process.. Please Hold";
// The next line calls the login_flash.php script. And returns the results from it to the movie.
loadVariablesNum ("login_flash.php?Name="+Name, "0");
} else {
Status = "Please enter a User Name";
}
}
Frame 1 has a stop()
Frame 2 and 3 have this code:
if (CheckLog ne "") {
gotoAndPlay (4);
} else {
gotoAndPlay (1);
}
Frame 4 is the frame the user sees if their name was in the database.
And the PHP script is:
<?
require 'include.php';
$Name = strtoupper ($Name);
$Name = ereg_replace("[^A-Za-z0-9 ]", "", $Name);
mysql_connect($DBhost,$DBuser,$DBpass);
mysql_select_db("$DBName");
$query = "SELECT * FROM $table WHERE Name = '$Name'";
$result = mysql_query($query);
$numR = mysql_num_rows($result);
if ($numR == 1) {
print "Status=Success Login Complete&CheckLog=1";
}
else {
print "Status=Failure - Your name was not found - Please register";
}
?>
Any ideas?