SoFunction
Updated on 2025-03-09

User detailed registration and judgment

There are three files:
The first is: (registered username) <?include("")?>
<div align=center>
<table width="89%" border="0">
    <tr>  
<td><font color="#ff0000">Current location: <a href="">Home</a>&gt;&gt;Register page</font></td>
    </tr>
  </table><br>

  <table width="82%" border="0" height="27">
    <tr>  
      <td height="14"><b><font color="#660099"><img src="images/" width="68" height="22">  
Please set the user name: (<font color="#FF0000">3-15 digits</font>)</font></b></td>
    </tr>
  </table>
  <form name="form1" method="post" action="">
    <table width="80%" border="0" height="154">
      <tr>  
        <td width="42%">  
<div align="right"><font color="#0000FF">User name:</font>
        </td>
        <td width="58%">  
          <input type="text" name="name" maxlength="20">
        </td></div>
      </tr>
      <tr>  
        <td colspan="2" height="27">  
Note: Usernames can only be made from English letters (a-z), numbers (0-9) and underscores ('_', '-', '.'
It is composed of, and cannot have spaces, and must start with English letters. </font></font> </div>
        </td>
      </tr>
      <tr>  
        <td colspan="2" height="14">  
<div align="left"><font size="2"><font color="#FF0000">For example:</font></font></div>
        </td>
      </tr>
      <tr>  
        <td colspan="2">  
<div align="center"><font size="2" color="#FF0000"><b><font color="#0000FF">√</font></b>Correct examples: jocky, lin_xing, nh2001</font></div>
        </td>
      </tr>
      <tr>  
        <td colspan="2">  
<div align="center"><font size="2" color="#FF0000"><b><font color="#0000FF">×</font></b>Error example: li
            kitty、ming:)、168kk</font></div>
        </td>
      </tr>
      <tr>  
        <td colspan="2" height="18">  
If you have filled in, please click the "</font><font size="2" color="#0000FF">Next step</font><font color="#0000FF">" button;
Click the "</font><font color="#FF0000">Cancel</font><font color="#0000FF">" button to cancel your just-in-one input and start over. </font>
            </font></div>
        </td>
      </tr>
      <tr>  
        <td colspan="2" height="19">  
          <div align="center">  

            <input type=image name=name2 src="images/" width="68" height="22" border="0">
           <input type=hidden name=name3 value=<?echo$name?>>
             <a href=""><img src="images/" width="68" height="22" border="0"></a></div>
        </td>
      </tr>
    </table>
  </form>
<br>

</div>
<br>
<?include("")?>
</body>
</html>
The second is: (judging whether the registered username is correct and duplicate, and then output the detailed registration form)
<?include("")?>
<div align=center>
<table width="89%" border="0">
    <tr>  
<td><font color="#ff0000">Current location: <a href="">Home</a>&gt;&gt;<a href=>Register page</a>&gt;&gt;Detailed information</font></td>
    </tr>
  </table><br>
<?
if($name==""){
echo"<br><center><font color=blue>Username cannot be empty. Please</font><a href=>Return</a></center><br>";
    include("");
    exit();
}
if(strlen($name)<3 || strlen($name)>15){
echo"<br><center><font color=blue>The length of the username does not meet the requirements. Please</font><a href=>Return</a></center><br>";
  include("");
    exit();
}
if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*$", $name)) {
echo"<br><center><font color=blue>The registration name can only be composed of alphanumeric characters. Please</font><a href=>Return</a></center><br>";
      include("");
    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, I already have the same username! Please</font><a href=>Return</a>.</center><br>";}
                 else{$conn=@mysql_connect("localhost");
                      $sql=@mysql_select_db("jocky",$conn);
                      $sqldo="insert into user1 (name) values ('$name')";
                     @mysql_query($sqldo,$conn);
echo"<br><center><font color=blue>Hello,</font>";
                 echo"<font color=red><b>$name</b></font></center>";
                 include("");
                 @mysql_close($conn);}
                include("");
                 exit();
             }
        }
    ?>
    </div>
<?include("")?>
</body>
</html>
The third is: (Judge whether the registration information is correct, then insert it into the database and log in again)
<?include("")?>
<div align=center>  
<table width="89%" border="0">
    <tr>  
<td><font color="#ff0000">Current location: <a href="">Home</a>&gt;&gt;<a href=>Register page</a>&gt;&gt;Detailed information</font></td>
    </tr>
  </table><br>
<?
if($truename==""){
echo"<br><center><font color=blue>The real name cannot be empty. Please</font><a href=javascript:(-1);>Return</a></center><br>";
    include("");
    exit();
}
if($password==""||$repassword==""){
echo"<br><center><font color=blue>The password cannot be empty. Please</font><a href=javascript:(-1);>Return</a></center><br>";
    include("");
    exit();
}
if($repassword!=$password){
echo"<br><center><font color=blue>The password entered twice is different. Please</font><a href=javascript:(-1);>Return</a></center><br>";
    include("");
    exit();
}
if(strlen($password)<6 || strlen($password)>15){
echo"<br><center><font color=blue>The length of the password does not meet the requirements. Please</font><a href=javascript:(-1);>Return</a></center><br>";
  include("");
    exit();
}
if($pwwhat==""){
echo"<br><center><font color=blue>The password prompts the problem cannot be empty. Please</font><a href=javascript:(-1);>Return</a></center><br>";
    include("");
    exit();
}
if($pwan==""){
echo"<br><center><font color=blue>The password prompts that the answer cannot be empty. Please</font><a href=javascript:(-1);>Return</a></center><br>";
    include("");
    exit();
}
if($personalid==""){
echo"<br><center><font color=blue>Identity card number cannot be empty. Please</font><a href=javascript:(-1);>Return</a></center><br>";
    include("");
    exit();
}
if(strlen($personalid)!=15 or strlen($personalid)!=18){
echo"<br><center><font color=blue>The ID number entered is not 15 or 18 digits. Please</font><a href=javascript:(-1);>Return</a></center><br>";
  include("");
    exit();
}*/
if($year=="" || $month=="" || $day==""){
echo"<br><center><font color=blue>Date of birth, month and day, is not filled in. Please</font><a href=javascript:(-1);>Return</a></center><br>";
  include("");
    exit();
}
if(strlen($year)!=4 || strlen($month)!=2 || strlen($day)!=2){
echo"<br><center><font color=blue>The year, month and day entered are incorrect. Please</font><a href=javascript:(-1);>Return</a></center><br>";
  include("");
    exit();
}
if (!eregi("^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3}$",$email)) {
echo"<br><center><font color=blue>E-Mail address format is incorrect. Please</font><a href=javascript:(-1);>Return</a></center><br>";
    include("");
    exit();
    }
if($tel==""){
echo"<br><center><font color=blue>The phone number you contact cannot be empty. Please</font><a href=javascript:(-1);>Return</a></center><br>";
    include("");
    exit();
}
if(strlen($tel)!=11 || strlen($tel)!=12 || strlen($tel)!=13){
echo"<br><center><font color=blue>The phone length of the contact is incorrect. Please</font><a href=javascript:(-1);>Return</a></center><br>";
    include("");
    exit();
}
if($gender==""){
$null1="empty";}
if($xueli==""){
$null2="empty";}
if($money==""){
$null3="empty";}
if($addr==""){
$null4="empty";}
      $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);
      $sqldo="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',";
     $sqldo.="'$birthday','$email','$tel','$null3','$null4','$time')";
      $query=@mysql_query($sqldo,$conn);
      if($query){
echo"<br><center><font color=blue>Congratulations, you have successfully registered! Please</font><a href=>Login</a></center><br>";
        exit();
          }else{
echo"<br><center><font color=blue>The server is busy and cannot register for you. Please register again later!</font><a href=>Return to the home page</a></center><br>";
          }
        @mysql_close($conn);
?>
</div>
<?include("")?>
</body>
</html>