注册审核
注册审核,分为三个页面:注册页面,登陆页面,审核页面
第一个页面,做,注册页面
---------------------------------------------------zhuceyemian.php-----------------------------------------------------------
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 5 <title>注册页面</title> 6 </head> 7 <body> 8 9 <!--haoyou数据库 yonghu表--> 10 <h2>注册页面</h2> 11 <form action="zhucechili.php" method="post"> 12 <div>用户名:<input type="text" name="uid" /></div><br /><br /> 13 <div>密码:<input type="password" name="pwd" /></div><br /><br /> 14 <div>姓名:<input type="text" name="xingming" /></div><br /><br /> 15 <div>性别:<input type="text" name="xingbie" /></div><br /><br /> 16 <div>生日:<input type="text" name="shengri" /></div><br /><br /> 17 <div><input type="submit" value="注册" /></div><!--提交按钮,提交数据--> 18 </form> 19 </body> 20 </html>
----------------------------------------------------------------zhucechili.php-------------------------------------------------------
1 <?php 2 include("DBDA.PHP"); 3 4 $uid = $_POST["uid"]; 5 $pwd = $_POST["pwd"]; 6 $xingming = $_POST["xingming"]; 7 $xingbie = $_POST["xingbie"]; 8 $shengri = $_POST["shengri"]; 9 10 $db = new DBDA(); 11 12 $sql = "insert into yonghu values('{$uid}','{$pwd}','{$xingming}','{$xingbie}','{$shengri}',false)";//表里有多少就写多少 //false某认都是没有通过的 //false 不要加引号因为一加引号就永远是ture 13 if($db->Query($sql,0)) 14 { 15 header("location:zhuceyemian.php"); 16 } 17 else 18 { 19 echo "注册失败"; 20 }
第二个页面,做,登陆页面
----------------------------------------------------------denglu.php-------------------------------------------------------
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 5 <title>登陆页面</title> 6 </head> 7 8 <body> 9 <form action="dengluchuli.php" method="post"> 10 <div>用户名:<input type="text" name="uid" /></div> 11 <div>密码:<input type="password" name="pwd" /></div> 12 <div><input type="submit" value="登陆" /></div> 13 </form> 14 </body> 15 </html>
----------------------------------------------------------dengluchuli.php--------------------------------------------------------------
1 <?php 2 session_start(); 3 include("DBDA.PHP"); 4 $db = new DBDA(); 5 6 $uid =$_POST["uid"]; 7 $pwd = $_POST["pwd"]; 8 9 10 $sql = "select Pwd from yonghu where uid='{$uid}'";//根据用户名查密码 11 12 $mima = $db->StrQuery($sql); 13 14 $sqlzt = "select IsOk from yonghu where uid='{$uid}'"; 15 $zt = $db->StrQuery($sqlzt); 16 //echo $zt; 17 18 if($uid!="" && $pwd!="") 19 { 20 if($pwd==$mima && $zt==1) 21 { 22 $_SESSION["uid"] = $uid; 23 header("location:shenhe.php"); 24 25 } 26 else 27 { 28 echo "用户名或密码不正确"; 29 30 } 31 } 32 else 33 { 34 echo "用户名或密码不正确"; 35 }
第三个页面,做,审核页面
---------------------------------shenhe.php-----------------------------------------
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 5 <title>审核页面</title> 6 </head> 7 <body> 8 <?php 9 session_start(); 10 include("DBDA.PHP"); 11 $db = new DBDA(); 12 if(empty($_SESSION["uid"])) 13 { 14 header("location:denglu.php"); 15 exit; 16 } 17 18 ?> 19 <table width="100%" border="1" cellpadding="0" cellspacing="0"> 20 <tr> 21 <td>用户名</td> 22 <td>姓名</td> 23 <td>性别</td> 24 <td>生日</td> 25 <td>操作</td> 26 </tr> 27 <?php 28 $sql = "select * from yonghu"; 29 $attr = $db->Query($sql); 30 foreach($attr as $v) 31 { 32 //处理操作 33 $caozuo=$v[5]?"<span style='background-color:red'>已通过</span>":"<a href='shenhechuli.php?uid={$v[0]}'>审核</a>"; 34 echo" 35 <tr> 36 <td>{$v[0]}</td> 37 <td>{$v[2]}</td> 38 <td>{$v[3]}</td> 39 <td>{$v[4]}</td> 40 <td>{$caozuo}</td> 41 </tr>"; 42 } 43 ?> 44 45 </table> 46 </body> 47 </html>
-------------------------------------------------------shenhechuli.php------------------------------------------------------------
1 <?php 2 3 include("DBDA.PHP"); 4 $uid = $_GET["uid"]; 5 $db = new DBDA(); 6 $sql = "update yonghu set IsOk=true where uid='{$uid}'"; 7 8 $db->Query($sql,0); 9 10 header("location:shenhe.php");