Urgent to write a registration page, including the user name and password, registration must be a password to enter 12345 to register, and then storage. If the password is not 12345, it does not return an exception alert

Source: Internet
Author: User
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;} 
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.