首页 > 代码库 > php数据访问-注册审核(重点)
php数据访问-注册审核(重点)
关于审核,如发表文章的审核、员工请假的审核、药品申请的审核等等,代码大同小异。
一.注册功能(zhece.php chuli.php)
1.zhece.php
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="UTF-8"> 5 <title></title> 6 </head> 7 <form method="post" action="chuli.php"> 8 <div style="margin:10px 500px"> 9 <h2 > 注册页面</h2> 10 <div>用户名:<input type="text" name="users"/></div><br /> 11 <div>密码:<input type="text" name="pwd"/></div><br /> 12 <div>姓名:<input type="text" name="name"/></div><br /> 13 <div>性别:<input type="text" name="sex"/></div><br /> 14 <div>生日:<input type="text" name="birthday"/></div><br /> 15 <input type="submit" value="http://www.mamicode.com/注册" /> 16 <a href="http://www.mamicode.com/denglu.php">已有账号,立即登录</a> 17 </div> 18 </form> 19 <body> 20 </body> 21 </html>
2.chuli.php
1 <?php 2 3 $users = $_POST["users"]; 4 $pwd = $_POST["pwd"]; 5 $name= $_POST["name"]; 6 $sex = $_POST["sex"]; 7 $birthday = $_POST["birthday"]; 8 require "DBDA.class.php"; 9 $db = new DBDA(); 10 $sql = "insert into users values (‘{$users}‘,‘{$pwd}‘,‘{$name}‘,{$sex},‘{$birthday}‘,0)"; 11 if($db->query($sql,0)){ 12 header("location:zhuce.php"); 13 14 } 15 ?>
二.登录功能(denglu.php login.php )
1.denglu.php
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="UTF-8"> 5 <title></title> 6 </head> 7 <body> 8 <form method="post" action="login.php"> 9 <div style="margin:100px 500px"> 10 <h2 > 登录页面</h2> 11 <div>用户名:<input type="text" name="users"/></div><br /> 12 <div>密码:<input type="text" name="pwd"/></div><br /> 13 <input type="submit" value="http://www.mamicode.com/登录" /> 14 <a href="http://www.mamicode.com/zhuce.php">没有账号,立即注册</a> 15 </div> 16 </form> 17 </body> 18 </html>
2.login.php
1 <?php 2 3 $users = $_POST["users"]; 4 $pwd = $_POST["pwd"]; 5 require "DBDA.class1.php"; 6 $db = new DBDA(); 7 $sql = "select * from users where users = ‘{$users}‘"; 8 $arr = $db->query($sql); 9 10 //$arr[0][1] 密码 11 //$arr[0][5] 审核状态 12 13 14 if($arr[0][1] == $pwd && !empty($pwd)) 15 { 16 if($arr[0][5]) 17 { 18 echo "登录成功!"; 19 } 20 else{ 21 echo "审核未通过!"; 22 } 23 } 24 else{ 25 echo "用户名或密码错误!"; 26 } 27 28 ?>
三.管理员的审核功能(guanliyuan.php tongguo.php chexiao.php)
1.guanliyuan.php
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="UTF-8"> 5 <title></title> 6 </head> 7 8 <body> 9 <h1>管理员审核</h1> 10 <table width="100%" border="1" cellpadding="0" cellspacing="0"> 11 <tr> 12 <td>用户名</td> 13 <td>密码</td> 14 <td>姓名</td> 15 <td>性别</td> 16 <td>生日</td> 17 <td>操作</td> 18 </tr> 19 <?php 20 require"DBDA.class1.php"; 21 $db = new DBDA(); 22 23 $sql = "select * from users"; 24 $arr = $db->query($sql); 25 26 foreach($arr as $v) 27 { 28 $str = ""; 29 if($v[5]) 30 { 31 $str = "<span style=‘color:green‘>已通过</span> 32 <a href=http://www.mamicode.com/‘chexiao.php?uid={$v[0]}‘>撤销</a>"; 33 } 34 else 35 { 36 $str = "<a href=http://www.mamicode.com/‘tongguo.php?uid={$v[0]}‘>通过</a>"; 37 } 38 39 echo "<tr> 40 <td>{$v[0]}</td> 41 <td>{$v[1]}</td> 42 <td>{$v[2]}</td> 43 <td>{$v[3]}</td> 44 <td>{$v[4]}</td> 45 <td>{$str}</td> 46 </tr>"; 47 } 48 ?> 49 </table> 50 </body> 51 </html>
2.tongguo.php
1 <?php 2 $uid = $_GET["uid"]; 3 require "DBDA.class.php"; 4 $db = new DBDA(); 5 $sql = "update users set isok=1 where uid=‘{$uid}‘"; 6 $db->query($sql,0); 7 header("location:guanliyuan.php");
3.chexiao.php
1 <?php 2 $uid = $_GET["uid"]; 3 require "DBDA.class.php"; 4 $db = new DBDA(); 5 $sql = "update users set isok=0 where uid=‘{$uid}‘"; 6 $db->query($sql,0); 7 header("location:guanliyuan.php");
php数据访问-注册审核(重点)
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。