码迷,mamicode.com
首页 > Web开发 > 详细

php 之 注册审核(0523)

时间:2016-05-23 16:57:33      阅读:182      评论:0      收藏:0      [点我收藏+]

标签:

 

当注册后,先将信息保存到session,通过审核后才会添加到数据库中,

审核通过后状态变为已通过,这时添加到数据库中的信息进行登录。若发现此用户的不良行为,可以撤销通过。

 

注册页面:

技术分享
 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 <h1>注册</h1>
10 <form action="zcchuli.php" method="post">
11     <div>
12         用户名:<input type="text" name="uid" /><br /><br />
13         密  码:<input type="text" name="psw" /><br /><br />
14         姓  名:<input type="text" name="name" /><br /><br />
15         性  别:<input type="text" name="sex" /><br /><br />
16         生  日:<input type="text" name="birthday" /><br /><br />
17         <input type="submit" value="注册" />
18     </div>
19 </form>
20 
21 </body>
22 </html>
View Code

注册处理:(注册成功后要进行审核)

技术分享
 1 <?php
 2 include ("../DBDA.class.php");
 3 $db=new DBDA();
 4 $uid=$_POST["uid"];
 5 $psw=$_POST["psw"];
 6 $name=$_POST["name"];
 7 $sex=$_POST["sex"];
 8 
 9 $s=1;
10 if($sex=="女")
11 {
12     $s=0;
13     }
14 
15 $birthday=$_POST["birthday"];
16 
17 
18 $sql = "insert into Users values(‘{$uid}‘,‘{$psw}‘,‘{$name}‘,{$s},‘{$birthday}‘,false)";
19 
20 //echo $sql;
21 $r=$db->Query($sql,1);
22 
23 if($r)
24 {
25     header ("location:zhuce.php");
26     }
27 else
28 {
29     echo "注册失败!";
30     }
View Code

 

登录页面:

技术分享
 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 <h1>登录</h1>
10 <form action="dlchuli.php" method="post">
11     <div>
12         用户名:<input type="text" name="uid" /><br /><br />
13 
14         密&nbsp;&nbsp;码:<input type="text" name="psw" /><br /><br />
15 
16         <input type="submit" value="登录" />
17     </div>
18 </form>
19 
20 </body>
21 </html>
View Code

登录处理:(审核通过才能登录)

技术分享
 1 <?php
 2 session_start();
 3 include ("../DBDA.class.php");
 4 $db=new DBDA();
 5 
 6 $uid=$_POST["uid"];
 7 $psw=$_POST["psw"];
 8 
 9 $sql="select count(*) from users where uid=‘{$uid}‘ and psw=‘{$psw}‘ and isok=true";
10 
11 $r=$db->StrQuery($sql);
12 
13 if($r==1)
14 {
15     $_SESSION["uid"]=$uid;
16     header("location:main.php");
17     }
18 else
19 {
20     header("location:denglu.php");
21     }
View Code

 

审核主页面:(只管理员可见)

技术分享
 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 <h1>审核</h1>
10 
11 <table width="100%" border="1" cellpadding="0" cellspacing="0">
12     <tr>
13         <td>姓名</td>
14         <td>性别</td>
15         <td>生日</td>
16         <td>状态</td>
17     </tr>
18 
19 <?php
20 include ("../DBDA.class.php");
21 $db=new DBDA();
22 $sql="select * from users";
23 $attr=$db->Query($sql);
24 foreach($attr as $v)
25 {
26     
27     //状态判断isok
28     $zt="";
29     if($v[5])
30     {
31         $zt="<span style=‘color:green‘>已通过</span>&nbsp;<a href=‘chexiao.php?uid={$v[0]}‘>撤销</a>";
32         }
33     else
34     {
35         $zt="<a href=‘shchuli.php?uid={$v[0]}‘>审核</a>";
36         }
37     
38     
39     echo "<tr>
40         <td>{$v[2]}</td>
41         <td>{$v[3]}</td>
42         <td>{$v[4]}</td>
43         <td>{$zt}</td>
44     </tr>";
45     
46     }
47 
48 ?>
49 </table>
50 </body>
51 </html>
View Code

审核处理:(审核成功显示已通过)

技术分享
 1 <?php
 2 $uid=$_GET["uid"];
 3 
 4 include("../DBDA.class.php");
 5 $db=new DBDA();
 6 
 7 $sql="update users set isok=true where uid=‘{$uid}‘";
 8 
 9 if($db->Query($sql,1))
10 {
11     header("location:main.php");
12     }
13 else
14 {
15     echo "审核失败!";
16     }
View Code

撤销处理:(撤销审核,无法登录)

技术分享
 1 <?php
 2 $uid=$_GET["uid"];
 3 include ("../DBDA.class.php");
 4 $db=new DBDA();
 5 $sql="update users set isok=false where uid=‘{$uid}‘";
 6 if($db->Query($sql,1))
 7 {
 8     header("location:main.php");
 9     }
10 else
11 {
12     echo "撤销失败!";
13     }
View Code

 

页面运行显示:

技术分享

 

技术分享

 

技术分享

 

php 之 注册审核(0523)

标签:

原文地址:http://www.cnblogs.com/ds-3579/p/5520265.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!