php註冊頁面代碼(mysql+php)

來源:互聯網
上載者:User

 include('global.php');

 代碼如下 複製代碼

 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('恭喜您,親愛的會員,您已經註冊成功!','index.php','現在去首頁。','http://www.111cn.net','先去論壇逛逛!');
  }else{
   $prompt_msg->p('非常抱歉,系統發生故障!');
  }
 }
?>

<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html xmlns="http://www.111cn.net/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<title></title>
<link rel="stylesheet" type="text/css教程" href="css/reg_log.css" />

</head>

<body>
<form id="myform" name="myform" method="post" action="register.php">
<div id="top">註冊&nbsp;<a href="login.php">登入</a></div>
<div id="content">
 <div class="c1">請填寫以下必填資訊完成註冊</div>
    <div class="c2"><span>帶紅色*的都是必填項目,若填寫不全將無法註冊</span></div>
    <div class="cinput"><dl>
     <dt>使用者名稱<font color="red">*</font></dt>
        <dd><input id="username" name="username" type="text" maxlength="12" /></dd>
        <dd id="user_prompt" class="prompt">大小寫英文字母、漢字、數字、底線組成的長度 3-12 個位元組以內</dd>
    </dl></div>
    <div class="cinput"><dl>
     <dt>密&nbsp;&nbsp;碼<font color="red">*</font></dt>
        <dd><input id="password1" name="password1" type="password" maxlength="16" /></dd>
        <dd id="pwd1_prompt" class="prompt">最小長度:6 最大長度:16,僅限字母、數字及_,字母區分大小寫</dd>
    </dl></div>         
    <!--檢測密碼強度-->
 <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>確認密碼<font color="red">*</font></dt>
        <dd><input id="password2" name="password2" type="password" maxlength="16" /></dd>
        <dd id="pwd2_prompt" class="prompt">請再輸入一遍您上面填寫的密碼</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">請填寫真實並且最常用的郵箱</dd>
    </dl></div>
    <div style="clear:both"></div>
</div>
<div id="bottom">
 <input class="btn1" type="submit" name="sub" value="提交註冊" id="checkall" />
 <input class="btn2" type="reset" name="reset" value="重設" onclick="return sub(this.form)" />
</div>
</form>
</body>
</html>

資料庫結構

 create table `hl`.`hl_member` (
`id` int( 4 ) not null auto_increment comment '自動編碼',
`username` varchar( 100 ) not null comment '使用者名稱稱',
`password` varchar( 200 ) not null comment '使用者密碼',
`answer` varchar( 100 ) not null comment '密保答案',
`question` varchar( 100 ) not null comment '密保問題',
`email` varchar( 100 ) not null comment 'email',
`realname` varchar( 200 ) not null comment '登入限制',
`birthday` date not null comment '出生日期',
`telephone` varchar( 20 ) not null comment '電話號碼',
`qq` varchar( 15 ) not null comment 'qq號碼',
`count` int( 1 ) not null comment '登入限制',
`active` int( 1 ) not null comment '是否啟用',
primary key ( `id` )
) engine = innodb character set gb2312 collate gb2312_chinese_ci;

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.