当前位置:首页 > 综合实例 > 列表

php注册页面代码(mysql+php)

发布:smiling 来源: PHP粉丝网  添加日期:2013-12-11 14:15:14 浏览: 评论:0 

php注册页面代码(mysql+php) 这是一款利用mysql php实例的用户注册代码,比较简单,就是把html 提交过来的数据保存到mysql数据库。

  1. include('global.php'); 
  2.  if($_post['sub']){ 
  3.   $user  = $_post['username']; 
  4.   $pwd   = md5($_post['password1'].$user); 
  5.   $email = $_post['email']; 
  6.    $q = $mysql->query("insert into `hl`.`hl_member`(`id`,`username`,`password`,`email`)values (null,'$user','$pwd','$email');"); 
  7.   if($q){ 
  8.    setcookie('login',$user); 
  9.    $prompt_msg->p('恭喜您,亲爱的会员,您已经注册成功!','index.php','现在去首页。','http://www.111cn.net','先去论坛逛逛!'); 
  10.   }else
  11.    $prompt_msg->p('非常抱歉,系统发生故障!'); 
  12.   } 
  13.  } 
  14. ?> 
  15. <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"
  16. <html xmlns="http://www.111cn.net/1999/xhtml"
  17. <head> 
  18. <meta http-equiv="content-type" content="text/html; charset=gb2312" /> 
  19. <title></title> 
  20. <link rel="stylesheet" type="text/css教程" href="css/reg_log.css" /> 
  21. </head> 
  22. <body> 
  23. <form id="myform" name="myform" method="post" action="register.php"
  24. <div id="top">注册&nbsp;<a href="login.php">登录</a></div> 
  25. <div id="content"
  26.  <div class="c1">请填写以下必填信息完成注册</div> 
  27.     <div class="c2"><span>带红色*的都是必填项目,若填写不全将无法注册</span></div> 
  28.     <div class="cinput"><dl> 
  29.      <dt>用户名<font color="red">*</font></dt> 
  30.         <dd><input id="username" name="username" type="text" maxlength="12" /></dd> 
  31.         <dd id="user_prompt" class="prompt">大小写英文字母、汉字、数字、下划线组成的长度 3-12 个字节以内</dd> 
  32.     </dl></div> 
  33.     <div class="cinput"><dl> 
  34.      <dt>密&nbsp;&nbsp;码<font color="red">*</font></dt> 
  35.         <dd><input id="password1" name="password1" type="password" maxlength="16" /></dd> 
  36.         <dd id="pwd1_prompt" class="prompt">最小长度:6 最大长度:16,仅限字母、数字及_,字母区分大小写</dd> 
  37.     </dl></div>          
  38.     <!--检测密码强度--> 
  39.  <div class="cinput" style="padding-bottom:0px;"><!--ie6 hack--> 
  40.      <div class="chkpwd"
  41.          <span id="cp1_prompt" class="cp1"></span><span id="cp2_prompt" class="cp2"></span> 
  42.             <span id="cp3_prompt" class="cp3"></span> 
  43.      </div> 
  44.     </div> 
  45.     <div class="cinput" style="padding-top:0px;"><dl> 
  46.      <dt>确认密码<font color="red">*</font></dt> 
  47.         <dd><input id="password2" name="password2" type="password" maxlength="16" /></dd> 
  48.         <dd id="pwd2_prompt" class="prompt">请再输入一遍您上面填写的密码</dd> 
  49.     </dl></div> 
  50.     <div class="cinput"><dl> 
  51.      <dt>email<font color="red">*</font></dt> 
  52.         <dd><input id="email" name="email" type="text" /></dd> 
  53.         <dd id="email_prompt" class="prompt">请填写真实并且最常用的邮箱</dd> 
  54.     </dl></div> 
  55.     <div style="clear:both"></div> 
  56. </div> 
  57. <div id="bottom"
  58.  <input class="btn1" type="submit" name="sub" value="提交注册" id="checkall" /> 
  59.  <input class="btn2" type="reset" name="reset" value="重置" onclick="return sub(this.form)" /> 
  60. </div> 
  61. </form> 
  62. </body> 
  63. </html> 
  64. 数据库结构 
  65.  create table `hl`.`hl_member` ( 
  66. `id` int( 4 ) not null auto_increment comment '自动编码'
  67. `username` varchar( 100 ) not null comment '用户名称'
  68. `password` varchar( 200 ) not null comment '用户密码'
  69. `answer` varchar( 100 ) not null comment '密保答案'
  70. `question` varchar( 100 ) not null comment '密保问题'
  71. `email` varchar( 100 ) not null comment 'email'
  72. `realname` varchar( 200 ) not null comment '登录限制'
  73. `birthday` date not null comment '出生日期'
  74. `telephone` varchar( 20 ) not null comment '电话号码'
  75. `qq` varchar( 15 ) not null comment 'qq号码'
  76. `count` int( 1 ) not null comment '登录限制'
  77. `active` int( 1 ) not null comment '是否激活'
  78. primary key ( `id` ) 
  79. ) engine = innodb character set gb2312 collate gb2312_chinese_ci; 

Tags: 注册 页面 代码 mysql+php

分享到: