Home  >  Article  >  Backend Development  >  Xinglin classmates (6)_PHP tutorial

Xinglin classmates (6)_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 16:04:06886browse

注册部分:
   注册步骤1: class/register_step1.php



班级通讯录-注册第一步


include "config.php";
if ($Submit){
$answers1=trim($answers1);
$answers2=trim($answers2);
if (!($answers1==$answer1)||!($answers2==$answer2)){
echo "回答错误!返回";
exit;
}
echo "回答正确,进入第二步。";
exit;
}
?>


    
    
  
  
    
  
  
    

      

    
  
      
注册第一步-身份验证

    

      

请回答以下问题


      

        
1.

          您的回答  
          
          

          2.

          您的回答  
          
          

          
          
        
php">Ask the administrator.

                                                                                    HTML>
Register Step 2: class/register_step2.php



Address Book of Class 1, Grade 94 - Registration Step 2

if (!$answer=="right"){                                                                                                                                                                                                  include "config.php";
if ($submit){
if (!$username||!$psw||!$psw2||!$name||!$ad||!$ph| |! $ Email) {// Check whether to fill in the complete
Echo "sorry, you have to fill in all the items with*! & lt; br & gt;". "& lt; a href = 'javascript: hestory.back ()' >Return";
exit;
}
$username=trim($username);
$psw=trim($psw);
$psw2=trim ($psw2);
$name=trim($name);
$birth=$year.'-'.$month.'-'.$day;
$work=trim($work );
$ad=trim($ad);
$post=trim($post);
$ph=trim($ph);
$bp=trim($bp);
$email=trim($email);
$oicq=trim($oicq);
$account=strip_tags(trim($account));//Remove leading and trailing spaces and html tags
$signature=strip_tags(trim($signature));
//Check whether this name has been registered
$result = mysql_query("SELECT name FROM user where name='$name'",$db);
if (mysql_num_rows($result)!=0){
echo "This name has already been registered! "."Refill "."Forgot your password? Ask the administrator for the password ;/a>";
exit;
}
//Check whether the username is used
$result = mysql_query("SELECT user FROM user where user='$username'",$db );//If the number of returned columns is not 0, it means that this username is already used by someone else
if (mysql_num_rows($result)!=0){
echo "This username is already used by someone else! "."
Refill";
exit;
}
//Check whether the repeated password is correct
if (!$psw==$psw2){
echo "Please confirm password,return";
exit;
}
//Check the validity of the email
if(!ereg('^[-!#$%&'*+./0-9=?A-Z^_`a-z{|}~] +'.'@'.'[-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+.'.'[-!#$%&'*+. /0-9=?A-Z^_`a-z{|}~]+$',$email)&&$email){
   echo "email is illegal!
"."Refill
";
exit;}
//Write to database
$sql="INSERT INTO user (user, psw,name,sex,birth,work,ad,post,ph,bp,email,oicq,account,signature,face) VALUES ('$username','$psw','$name','$sex', '$birth','$work','$ad','$post','$ph','$bp','$email','$oicq','$account','$signature', '$face')";
$result = mysql_query($sql,$db);
mysql_close($db);
//Send a congratulatory email
$subject="Congratulations on your successful registration ".$sitename."! ";//Topic
$message=$name.",Hello:
Congratulations on your successful registration in the classmate directory! Your username is ".$username." and your password is ".$psw."
Log in now$sitename";//Content of the message
$headers .= "Content-Type: text/html; charset=gb2312n"; // Mime type
mail($email,$subject,$message,$headers);//When debugging offline, This sentence may be wrong, don't worry about it, just send it to the server
echo "Congratulations on your successful registration! A welcome letter has been sent to your email, please check it.","现在登录";  
exit;
}  
?>

    
    
  
    
                                                          '?answer=right'>
                                                                                                                            bordercolor="#FFCC00">
                                                 
       *
🎜>                                                                                     , The length should not exceed 8 characters)

                                                                                                                                                                                                                               ;br>
                                                                                                        
                                                                                                                                                                                                      
                                                                                                                                                                                                                                                                                          "
                                                                                                                                                            >                                                                                                                                   >                                                                                                                                  < ;option>1981
                                    ;option>1978
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
          
          年  
          
          月  
          
          日

          工作单位:  
          
          

          通讯地址:  
          
          *

          邮编:  
          


                                                                              
                                                                                                                                             ' name='email' size='15' maxlength='35'>
                                                                      12' maxlength='12'>
                                                                                                                                                                                              cols='50' rows='5'>
                                                                                                                     >                                                                                                                                                          ">

     Choose an avatar you like:

     
                 
                                                                                > 32"> "32"> " height="32"> "32" height="32">
width = "32" height = "32" gif" width="32" height="32">
          
            
          
            
          
                
              
            
          
            
          
            
          
            
          
            
          
            
          
            
          
            
          
            
          
          

            
          
            
          
            
          
            
          
            
          
            
          
            
          
            
          
            
          
            
          
            
          
            
          
            
          
            
          
            
          
            
          
            
          
            
          
            
          
            
          
          

            
          
            
          
            
          
            
          
            
          
            
          
            
          
            
          
            
          
            
          
                
              
            
          
            
          
            
          
            
          
            
          
            
          
            
          
            
          
            
          
          

            
          
            
          
            
          
            
          
          

            
          
        
  
      

    
  
      
注册第二步-填写个人资料

        注意不要有空格,带*的项目为必填。

        

        

          

          
          

                                                                   /HTML>



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

www.bkjia.com

truehttp: //www.bkjia.com/PHPjc/316057.htmlTechArticleRegistration part: Registration step 1: class/register_step1.php HTML HEAD meta http-equiv=Content-Type content= text/html; charset=gb2312 TITLE class address book - first step of registration/TITLE /HEAD BOD...
Statement:
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