Detailed user registration and judgment

Source: Internet
Author: User
The user's detailed registration and judgment, read the user's detailed registration and judgment, there are three Files: The first is: zcyh. php (registered user name )? Include (header1.inc. php )? Divalign = centertablewidth = 89% border = 0tr & nb... "> <LINKhref =" http: // www. php100. there are three files:
First: zcyh. php (registered user name)





Current location: Home> registration page








Set the user name (3-15 characters)











The second one is: register. php (judge whether the registered user name is correct and whether it is repeated, and then output the detailed registration form)






Current location: Home> registration page> Details


If ($ name = ""){
Echo"
The user name cannot be blank. Please return
";
Include ("foot. inc. php ");
Exit ();
}
If (strlen ($ name) <3 | strlen ($ name)> 15 ){
Echo"
The length of the user name is invalid. Please return
";
Include ("foot. inc. php ");
Exit ();
}
If (! Eregi ("^ [_ a-z0-9-] + (\. [_ a-z0-9-] +) * $", $ name )){
Echo"
The registration name can only consist of letters and numbers. please return
";
Include ("foot. inc. php ");
Exit ();
}
If ($ name)
{
$ Conn = @ mysql_connect ("localhost ");
$ SQL = @ mysql_select_db ("jocky", $ conn );
$ Result = @ mysql_query ("select * from user1 where name = '$ name'", $ conn );
If ($ result ){
If (@ mysql_fetch_object ($ result )){
Echo"
Sorry, you already have the same user name! Please return.
";}
Else {$ conn = @ mysql_connect ("localhost ");
$ SQL = @ mysql_select_db ("jocky", $ conn );
$ Sqldc = "insert into user1 (name) values ('$ name ')";
@ Mysql_query ($ sqldc, $ conn );
Echo"
Hello ,";
Echo" $ Name ";
Include ("zhuce. php ");
@ Mysql_close ($ conn );}
Include ("foot. inc. php ");
Exit ();
}
}
?>




Third: check. php (check whether the registration information is correct, insert the database, and log on again)






Current location: Home> registration page> Details


If ($ truename = ""){
Echo"
The real name cannot be blank. Please return
";
Include ("foot. inc. php ");
Exit ();
}
If ($ password = "" | $ repassword = ""){
Echo"
The password cannot be blank. Please return
";
Include ("foot. inc. php ");
Exit ();
}
If ($ repassword! = $ Password ){
Echo"
The two passwords are different. Please return
";
Include ("foot. inc. php ");
Exit ();
}
If (strlen ($ password) <6 | strlen ($ password)> 15 ){
Echo"
The password length is invalid. Please return
";
Include ("foot. inc. php ");
Exit ();
}
If ($ pwwhat = ""){
Echo"
The password prompt cannot be blank. Please return
";
Include ("foot. inc. php ");
Exit ();
}
If ($ pwan = ""){
Echo"
The answer to the password prompt cannot be blank. Please return
";
Include ("foot. inc. php ");
Exit ();
}
If ($ personalid = ""){
Echo"
The ID number cannot be blank. Please return
";
Include ("foot. inc. php ");
Exit ();
}
If (strlen ($ personalid )! = 15 or strlen ($ personalid )! = 18 ){
Echo"
The ID number is not 15 or 18 characters. Please return
";
Include ("foot. inc. php ");
Exit ();
}*/
If ($ year = "" | $ month = "" | $ day = ""){
Echo"
The date of birth is not specified. Please return
";
Include ("foot. inc. php ");
Exit ();
}
If (strlen ($ year )! = 4 | strlen ($ month )! = 2 | strlen ($ day )! = 2 ){
Echo"
The entered date is incorrect. Please return
";
Include ("foot. inc. php ");
Exit ();
}
If (! Eregi ("^ [_\. 0-9a-z-] + @ ([0-9a-z] [0-9a-z-] + \.) + [a-z] {2, 3} $ ", $ email )){
Echo"
The email address format is incorrect. Please return
";
Include ("foot. inc. php ");
Exit ();
}
If ($ tel = ""){
Echo"
The contact number cannot be blank. Please return
";
Include ("foot. inc. php ");
Exit ();
}
If (strlen ($ tel )! = 11 | strlen ($ tel )! = 12 | strlen ($ tel )! = 13 ){
Echo"
The contact phone number is invalid. Please return
";
Include ("foot. inc. php ");
Exit ();
}
If ($ gender = ""){
$ Null1 = "null ";}
If ($ xueli = ""){
$ Null2 = "null ";}
If ($ money = ""){
$ Null3 = "null ";}
If ($ addr = ""){
$ Null4 = "null ";}
$ Birthday = "$ year.-. $ month.-. $ day ";
$ Time = time ();
$ Conn = @ mysql_connect ("localhost ");
$ SQL = @ mysql_select_db ("jocky", $ conn );
$ Result = @ mysql_query ("select * from user1 where name = '$ name'", $ conn );
$ Sqldc = "insert into user1 (name, truename, password, pwwhat, pwan, personalid, gender, xueli, birth, email, tel, money, addr, time) values ('$ name',' $ truename', '$ password',' $ pwwhat ',' $ pwan ',' $ personalid ',' $ null1 ', '$ null2 ',";
$ Sqldc. = "'$ birthday', '$ email', '$ Tel',' $ null3 ',' $ null4 ',' $ time ')";
$ Query = @ mysql_query ($ sqldc, $ conn );
If ($ query ){
Echo"
Congratulations! you have registered successfully! Please log on
";
Exit ();
} Else {
Echo"
The server is busy and cannot be registered for you. please register later! Home Page
";
}
@ Mysql_close ($ conn );
?>





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.