PHP registration page code (mysql+php)

Source: Internet
Author: User

 include (' global.php ');

  code is as follows copy code

 if ($_post[' Sub ']) {
   $user   = $_post[' username '];
   $pwd    = MD5 ($_post[' Password1 ']. $user);
   $email = $_post[' email '];
    $q = $mysql->query (insert INTO ' hl '. ' Hl_member ' (' id ', ' username ', ' password ', ' email ') VALUES (null, ' $user ', ' $pwd ', ' $email ');
  if ($q) {
   setcookie (' login ', $user);
    $prompt _msg->p ( ' Congratulations, dear member, you have registered successfully! ', ' index.php ', ' Now go home. ', ' http://www.111cn.net ', ' Go to the forum to wander first! ');
  }else{
    $prompt _msg->p (' Very sorry, the system has failed! ');
  }
 }
?

<!doctype HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/ Xhtml1-transitional.dtd ">
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "/>
<title></title>
<link rel= "stylesheet" type= "text/css Course" href= "Css/reg_log.css"/>

<body>
<form id= "MyForm" name= "MyForm" method= "post" action= "register.php" >
<div id= "Top" > Register &nbsp;<a href= "login.php" > Login </a></div>
<div id= "Content" >
<div class= "C1" > Please complete the following required information for registration </div>
<div class= "C2" ><span> with red * are required items, if not complete will not be able to register </span></div>
<div class= "Cinput" ><dl>
<dt> username <font color= "Red" >*</font></dt>
<dd><input id= "username" name= "username" type= "text" maxlength= ""/></dd>
<dd id= "user_prompt" class= "prompt" > uppercase and lowercase letters, Chinese characters, numbers, underscores 3-12 bytes in length </dd>
</dl></div>
<div class= "Cinput" ><dl>
<dt> Secret &nbsp;&nbsp; code <font color= "Red" >*</font></dt>
<dd><input id= "Password1" name= "password1" type= "password" maxlength= ""/></dd>
<dd id= "pwd1_prompt" class= "prompt" > Minimum Length: 6 Maximum length: 16, only letters, numbers and _, letters are case-sensitive </dd>
</dl></div>
<!--detection Password strength-->
<div class= "Cinput" style= "padding-bottom:0px;" ><!--IE6 hack-->
<div class= "Chkpwd" >
<span id= "cp1_prompt" class= "CP1" ></span><span id= "cp2_prompt" class= "CP2" ></span>
<span id= "cp3_prompt" class= "CP3" ></span>
</div>
</div>
<div class= "Cinput" style= "padding-top:0px;" ><dl>
<dt> Confirm password <font color= "Red" >*</font></dt>
<dd><input id= "Password2" name= "password2" type= "password" maxlength= ""/></dd>
<dd id= "pwd2_prompt" class= "prompt" > Please re-enter the password you filled in </dd>
</dl></div>
<div class= "Cinput" ><dl>
<dt>email<font color= "Red" >*</font></dt>
<dd><input id= "Email" name= "email" type= "text"/></dd>
<dd id= "email_prompt" class= "prompt" > Please fill in the real and most commonly used mailbox </dd>
</dl></div>
<div style= "Clear:both" ></div>
</div>
<div id= "Bottom" >
<input class= "BTN1" type= "Submit" Name= "sub" value= "Submit Registration" id= "Checkall"/>
<input class= "BTN2" type= "reset" name= "reset" value= "reset" onclick= "return sub (this.form)"/>
</div>
</form>
</body>

Database structure

 create table ' hl '. ' Hl_member ' (
' id ' int (4) NOT NULL auto_increment comment ' automatic encoding ',
' username ' varchar ( Not null comment ' user name ',
' password ' varchar ' NOT null comment ' user password ',
' answer ' varchar (MB) not nul L Comment ' secret answer ',
' question ' varchar (MB) NOT NULL comment ' secret security issue ',
' email ' varchar (MB) NOT null comment ' Emai L ',
' realname ' varchar NOT NULL comment ' login restrictions ',
' birthday ' date not null comment ' Date of birth ',
' telephone ' VA Rchar NOT NULL comment ' phone number ',
' QQ ' varchar NOT NULL comment ' QQ number ',
' count ' int (1) NOT NULL comment ' Login restrictions ',
' active ' int (1) NOT null comment ' active ',
primary key (' ID ')
) engine = InnoDB Character Set gb231 2 collate gb2312_chinese_ci;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.