Home > Backend Development > PHP Tutorial > Detailed registration and judgment of users_PHP tutorial

Detailed registration and judgment of users_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-21 16:06:08
Original
1089 people have browsed it

有三个文件:
第一是:zcyh.php(注册用户名)



      
      
    
  
当前位置:主页>>注册页面



  
      
      
    
  
  
        请设定用户名:(3-15位

  

    
        
        
        
      
        
        
      
        
        
      
        
        
      
        
        
      
        
        
      
        
        
      
    
  
          
用户名:
        
  
          
        
  
          
注意:用户名只能由英文字母(a-z),数字(0-9)和下划线('_'、'-'、'.'  
            )构成,不能有空格,且必须以英文字母为开头。

        
  
          
例如:

        
  
          
正确的例子:jocky、lin_xing、nh2001

        
  
          
×错误的例子:li  
            kitty、ming:)、168kk

        
  
          
如果你已经填写好,请点“下一步”按钮;  
            点“
取消”按钮即取消您刚才的输入,重新开始。  
            

        
  
          
  

            
           >
             

        

  










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



a href="index.php">Homepage>>Registration page>>Details


Username cannot be empty. Pleasereturn

";
include("foot.inc.php");
exit();
}
if(strlen($name)<3 || strlen($name)>15){
echo"
The length of the username does not meet the requirements.请返回

";
  include("foot.inc.php");
    exit();
}
if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*$", $name)) {
       echo"
注册名只能由字母数字组成.请返回

";
      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"
对不起,已经有相同的用户名!请返回.

";}
                 else{$conn=@mysql_connect("localhost");
                      $sql=@mysql_select_db("jocky",$conn);
                      $sqldo="insert into user1 (name) values ('$name')";
                     @mysql_query($sqldo,$conn);
                 echo"
你好,";
                 echo"$name
";
                 include("zhuce.php");
                 @mysql_close($conn);}
                include("foot.inc.php");
                 exit();
             }
        }
    ?>
    




The third one is: check.php (determine registration Is the data correct, then insert it into the database and log in again)






Current location: Home page >>Registration page>>Details


if($truename==""){
echo"
The real name cannot be empty. Pleasereturn

";
include ("foot.inc.php");
exit();
}
if($password==""||$repassword==""){
echo"Password cannot be empty. Pleasereturn";
include("foot.inc.php");
exit();
}
if($repassword!=$password){
echo"
The passwords entered twice are different. Pleasereturn

";
include("foot.inc. php");
exit();
}
if(strlen($password)<6 || strlen($password)>15){
echo"
< ;center>The password length does not meet the requirements. Pleasereturn
";
include("foot.inc. php");
exit();
}
if($pwwhat==""){
echo"
Password prompt Question cannot be empty. Pleasereturn

";
include("foot.inc. php");
exit();
}
if($pwan==""){
echo"
Password prompt The answer cannot be empty. Pleasereturn

";
include("foot.inc. php");
exit();
}
if($personalid==""){
echo"
ID card Number cannot be empty. Pleasereturn

";
include("foot.inc. php");
exit();
}
if(strlen($personalid)!=15 or strlen($personalid)!=18){
echo"
< center>The entered ID number is not 15 or 18 digits. Pleasereturn
";
include("foot.inc. php");
exit();
}*/
if($year=="" || $month=="" || $day==""){
echo "
The date of birth is not filled in.Pleasereturn

";
include("foot.inc. php");
exit();
}
if(strlen($year)!=4 || strlen($month)!=2 || strlen($day)!=2){
echo"
The entered year, month and day is incorrect. Pleasereturn

";
include("foot.inc. php");
exit();
}
if (!eregi("^[_.0-9a-z-]+@([0-9a-z][0-9a- z-]+.)+[a-z]{2,3}$",$email)) {
echo"
The E-Mail address format is incorrect. Pleasereturn

";
include("foot.inc. php");
exit();
}
if($tel==""){
echo"
Contact Phone cannot be empty. Pleasereturn

";
include("foot.inc. php");
exit();
}
if(strlen($tel)!=11 || strlen($tel)!=12 || strlen($tel)!=13){
echo"
The length of the contact number is incorrect. Pleasereturn

";
include("foot.inc. php");
exit();
}
if($gender==""){
$null1="empty";}
if($xueli=="" ){
$null2="null";}
if($money==""){
$null3="null";}
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"
Congratulations, you have successfully registered! Pleaselog in
";
exit();
else{
echo"
The server is busy and cannot register for you, please Sign up later! Back to homepage

"; >








http://www.bkjia.com/PHPjc/315509.html

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/315509.htmlTechArticle has three files: The first is: zcyh.php (registered user name)?include(header1.inc.php )? div align=center table width=89% border=0 tr tdfont color=#ff0000Current location: a href=index.php main...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template