Home >Backend Development >PHP Tutorial >Classmate Xinglin's Record 6
注册部分:
注册步骤1: class/register_step1.php
| ||||
注册第一步-身份验证 | ||||
请回答以下问题 Bar. .php & lt;/head & gt; & lt; body bgcolor = "#ffffff" & gt; & lt;? PHP IF (! $ Answer == "Right" ") Ingenious ! "; exit; } include "config.php"; if ($submit){ if (!$username||!$psw||!$psw2||!$name||!$ad|| ! $ PH ||! $ Email) {// Check whether to fill in the complete !!!!!!!! You must fill in all the projects with*! & lt; br & gt; "." & lt; a & gt; return & lt;/a & gt; " ; 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 password"; 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 already exists. Use if (mysql_num_rows($result)!=0){ echo "This username is already used! "."Refill"; exit; } //Check whether the repeated password is correct if (!$psw==$psw2){ echo "Please confirm the password,< ;a >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 "; ,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 letter $headers .= "Content-Type: text/html; charset=gb2312n"; // Mime type mail($email,$subject,$message,$headers);//When debugging offline, this sentence may If something goes 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; } ?>
The above has introduced Xinglin Classmate Record 6, including various aspects. I hope it will be helpful to friends who are interested in PHP tutorials. 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 Previous article:import text to mysql how to import data from text to mysqlNext article:import text to mysql how to import data from text to mysql Related articlesSee more |