There are three files:
The first is: zcyh. php (Registered User Name) <? Include ("header1.inc. php")?>
<Div align = center>
<Table width = "89%" border = "0">
<Tr>
<Td> <font color = "# ff0000"> current location: <a href = "index. php "> homepage </a> registration page </font> </td>
</Tr>
</Table> <br>
<Table width = "82%" border = "0" height = "27">
<Tr>
<Td height = "14"> <B> <font color = "#660099">
Set the User name: (<font color = "# FF0000"> 3-15 characters </font>) </font> </B> </td>
</Tr>
</Table>
<Form name = "form1" method = "post" action = "register. php">
<Table width = "80%" border = "0" height = "154">
<Tr>
& Lt; td width = "42%" & gt;
<Div align = "right"> <font color = "# 0000FF"> User name: </font>
</Td>
& Lt; td width = "58%" & gt;
<Input type = "text" name = "name" maxlength = "20">
</Td> </div>
</Tr>
<Tr>
<Td colspan = "2" height = "27">
<Div align = "left"> <font size = "2"> <font color = "# FF0000"> note: </font> <font color = "# 0000FF"> a user name can only contain letters (a-z) and numbers (0-9) and underlines ('_','-','.'
Must start with an English letter. </Font> </div>
</Td>
</Tr>
<Tr>
<Td colspan = "2" height = "14">
<Div align = "left"> <font size = "2"> <font color = "# FF0000"> example: </font> </div>
</Td>
</Tr>
<Tr>
<Td colspan = "2">
<Div align = "center"> <font size = "2" color = "# FF0000"> <B> <font color = "# 0000FF"> √ </font> </B> correct example: jocky, lin_xing, and nh2001 </font> </div>
</Td>
</Tr>
<Tr>
<Td colspan = "2">
<Div align = "center"> <font size = "2" color = "# FF0000"> <B> <font color = "# 0000FF"> × </font> </B> example of an error: li
Kitty, ming :), 168kk </font> </div>
</Td>
</Tr>
<Tr>
<Td colspan = "2" height = "18">
<Div align = "center"> <font size = "2" color = "# 0000FF"> if you have already filled in, click "</font> <font size =" 2 "> <font color =" # FF0000 "> next </font> <font color =" # 0000FF "> ".;
Click "</font> <font color =" # FF0000 "> cancel </font> <font color =" # 0000FF ">" to cancel your input, start again. </Font>
</Font> </div>
</Td>
</Tr>
<Tr>
<Td colspan = "2" height = "19">
<Div align = "center">
<Input type = image name = name2 src = "images/xyb.gif" width = "68" height = "22" border = "0">
<Input type = hidden name = name3 value = <? Echo $ name?>
<A href = "zcyh. php "> </a> </div>
</Td>
</Tr>
</Table>
</Form>
<Br>
</Div>
<Br>
<? Include ("foot. inc. php")?>
</Body>
</Html>
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)
<? Include ("header1.inc. php")?>
<Div align = center>
<Table width = "89%" border = "0">
<Tr>
<Td> <font color = "# ff0000"> current location: <a href = "index. php "> homepage </a> <a href = zcyh. php> registration page </a> details </font> </td>
</Tr>
</Table> <br>
<?
If ($ name = ""){
Echo "<br> <center> <font color = blue> the user name cannot be blank. Please </font> <a href = zcyh. php> return </a> </center> <br> ";
Include ("foot. inc. php ");
Exit ();
}
If (strlen ($ name) <3 | strlen ($ name)> 15 ){
Echo "<br> <center> <font color = blue> the length of the user name is invalid. Please </font> <a href = zcyh. php> return </a> </center> <br> ";
Include ("foot. inc. php ");
Exit ();
}
If (! Eregi ("^ [_ a-z0-9-] + (\. [_ a-z0-9-] +) * $", $ name )){
Echo "<br> <center> <font color = blue> the registration name can only consist of letters and numbers. please </font> <a href = zcyh. php> return </a> </center> <br> ";
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 "<br> <center> <font color = blue> sorry, you already have the same user name! Please </font> <a href = zcyh. php> return </a>. </center> <br> ";}
Else {$ conn = @ mysql_connect ("localhost ");
$ SQL = @ mysql_select_db ("jocky", $ conn );
$ Sqldc = "insert into user1 (name) values ('$ name ')";
@ Mysql_query ($ sqldc, $ conn );
Echo "<br> <center> <font color = blue> hello, </font> ";
Echo "<font color = red> <B> $ name </B> </font> </center> ";
Include ("zhuce. php ");
@ Mysql_close ($ conn );}
Include ("foot. inc. php ");
Exit ();
}
}
?>
</Div>
<? Include ("foot. inc. php")?>
</Body>
</Html>
Third: check. php (check whether the registration information is correct, insert the database, and log on again)
<? Include ("header1.inc. php")?>
<Div align = center>
<Table width = "89%" border = "0">
<Tr>
<Td> <font color = "# ff0000"> current location: <a href = "index. php "> homepage </a> <a href = zcyh. php> registration page </a> details </font> </td>
</Tr>
</Table> <br>
<?
If ($ truename = ""){
Echo "<br> <center> <font color = blue> the real name cannot be blank. </Font> <a href = javascript: history. go (-1);> return </a> </center> <br> ";
Include ("foot. inc. php ");
Exit ();
}
If ($ password = "" | $ repassword = ""){
Echo "<br> <center> <font color = blue> the password cannot be blank. </Font> <a href = javascript: history. go (-1);> return </a> </center> <br> ";
Include ("foot. inc. php ");
Exit ();
}
If ($ repassword! = $ Password ){
Echo "<br> <center> <font color = blue> the two passwords are different. </Font> <a href = javascript: history. go (-1);> return </a> </center> <br> ";
Include ("foot. inc. php ");
Exit ();
}
If (strlen ($ password) <6 | strlen ($ password)> 15 ){
Echo "<br> <center> <font color = blue> the password length is invalid. </Font> <a href = javascript: history. go (-1);> return </a> </center> <br> ";
Include ("foot. inc. php ");
Exit ();
}
If ($ pwwhat = ""){
Echo "<br> <center> <font color = blue> the password prompt cannot be blank. </Font> <a href = javascript: history. go (-1);> return </a> </center> <br> ";
Include ("foot. inc. php ");
Exit ();
}
If ($ pwan = ""){
Echo "<br> <center> <font color = blue> the answer to the password prompt cannot be blank. </Font> <a href = javascript: history. go (-1);> return </a> </center> <br> ";
Include ("foot. inc. php ");
Exit ();
}
If ($ personalid = ""){
Echo "<br> <center> <font color = blue> the ID card number cannot be blank. </Font> <a href = javascript: history. go (-1);> return </a> </center> <br> ";
Include ("foot. inc. php ");
Exit ();
}
If (strlen ($ personalid )! = 15 or strlen ($ personalid )! = 18 ){
Echo "<br> <center> <font color = blue> the ID number is not 15 or 18 characters. </Font> <a href = javascript: history. go (-1);> return </a> </center> <br> ";
Include ("foot. inc. php ");
Exit ();
}*/
If ($ year = "" | $ month = "" | $ day = ""){
Echo "<br> <center> <font color = blue> the date of birth is not specified. </Font> <a href = javascript: history. go (-1);> return </a> </center> <br> ";
Include ("foot. inc. php ");
Exit ();
}
If (strlen ($ year )! = 4 | strlen ($ month )! = 2 | strlen ($ day )! = 2 ){
Echo "<br> <center> <font color = blue> the input date is incorrect. </Font> <a href = javascript: history. go (-1);> return </a> </center> <br> ";
Include ("foot. inc. php ");
Exit ();
}
If (! Eregi ("^ [_\. 0-9a-z-] + @ ([0-9a-z] [0-9a-z-] + \.) + [a-z] {2, 3} $ ", $ email )){
Echo "<br> <center> <font color = blue> the email address format is incorrect. </Font> <a href = javascript: history. go (-1);> return </a> </center> <br> ";
Include ("foot. inc. php ");
Exit ();
}
If ($ tel = ""){
Echo "<br> <center> <font color = blue> the contact number cannot be blank. </Font> <a href = javascript: history. go (-1);> return </a> </center> <br> ";
Include ("foot. inc. php ");
Exit ();
}
If (strlen ($ tel )! = 11 | strlen ($ tel )! = 12 | strlen ($ tel )! = 13 ){
Echo "<br> <center> <font color = blue> the contact phone number length is incorrect. </Font> <a href = javascript: history. go (-1);> return </a> </center> <br> ";
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 "<br> <center> <font color = blue> congratulations, you have registered successfully! </Font> <a href = index. php> log on </a> </center> <br> ";
Exit ();
} Else {
Echo "<br> <center> <font color = blue> the server is busy and cannot be registered for you. Please register again later! </Font> <a href = index. php> homepage </a> </center> <br> ";
}
@ Mysql_close ($ conn );
?>
</Div>
<? Include ("foot. inc. php")?>
</Body>
</Html>