Tokyu Write a registration page, including the user name and password, you must enter the password 12345 to register, and then storage. If the password is not 12345, it does not return an error alert
Tokyu Write a registration page, including the user name and password, you must enter the password 12345 to register, and then storage. If the password is not 12345, it does not return an error alert
------Solution--------------------
if (' 12345 ' <> $_post[' pwd ')
{
Exit (' You must fill in the password as 12345 ');
}
------Solution--------------------
No database content everything's a tinker.
a.php
b.php
mysql_connect (' localhost ', ' root ', ');
mysql_query (' SET NAMES ' GBK "');
mysql_select_db (' databases ');
if (Isset ($_post[' passwd ')) {
if (Intval ($_post[' passwd ')) = = 12345) {
$name = $_post[' username ');
$pass = intval ($_post[' passwd ');
$SQL = "INSERT into table (USERNAME,PASSWD) VALUES (' {$name} ', ' {$pass} ')";
mysql_query ($SQL);
} else {
Exit (' error. ');
}
}
?>
------Solution--------------------
You are going to hand in your homework = =!
------Solution--------------------
Since it was written dead, don't show the password when you enter the data. You entered the database to make a default value.
After successful registration, let him change himself.
------Solution--------------------
You can also add validation on the Submit page
Enter the password is not 12345 do not submit:
JScript code
if (Document.getelemntbyid ("password")! = ' 12345 ') {alert ("Password entered incorrectly!") "); return;}