Register Core Code recevier.php

Source: Internet
Author: User

<?php

Load configuration file
Include '. /init.php ';

Connecting to a database
Include Dir_core. ' Mysqldb.php ';


Accept the information sent by the form only son.

$username = Trim ($_post[' username ');
$password 1 = Trim ($_post[' password1 ');
$password 2 = Trim ($_post[' password2 ');
$vcode = Trim ($_post[' vcode ');

Judging the legitimacy of data
if (Empty ($username) | | empty ($password 1) | | empty ($password 2)) {
Header ("refresh:2;url=./register.php");
Die ("User name or password cannot be empty, please re-register!") ");
}
if (strlen ($username) >20) {
Header ("refresh:2;url=./register.php");
Die ("The valid length of the user name cannot exceed 20 digits, please re-register!") ");
}
if ($password 1!== $password 2) {
Header ("refresh:2;url=./register.php");
Die ("The password is inconsistent, please re-register!") ");
}
if (strlen ($password 1) <6 | | strlen ($password 1) >16) {
Header ("refresh:2;url=./register.php");
Die ("Password valid length is 6-16 bit, please re-register!") ");
}

$sql = "SELECT * from user where user_name = ' $username '";
$result = My_query ($sql);
if (Mysql_affected_rows () >0) {
Header ("refresh:2;url=./register.php");
Die ("User name already exists, please re-register!") ");
}

Inserting data
$password 1=md5 ($password 1);
$sql = "INSERT into user values (null, ' $username ', ' $password 1 ')";
$result =my_query ($sql);
if ($result) {
Header ("refresh:2;url=./login.php");
Die ("Registration successful! 2 seconds to jump to the login screen ");
}else{
Header ("refresh:2;url=./register.php");
Die ("An unknown error occurred, please re-register!") ");
}

Register Core Code recevier.php

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.