如何用PHP做到页面注册审核

yipeiwu_com5年前PHP代码库

用户注册后就有该条用户记录,你对用户表设一个“审核状态”字段,默认值设为“未审核”,然后你写几句审核代码做成一个功能,按照你们的意愿若审核通过你把审核状态改为“已审核”就行了。用户想进行各种操作时,你先判断一下审核状态字段,若未审核则阻止并给出一些提示信息,否则放行。

注册页面

<body >
<h1>注册页面</h1>
<form action="zhucechuli.php" method="post">
<div>用户名:<input type="text" name="uid"/> </div>
<div>密码:<input type="text" name="pwd"/> </div>
<div>姓名:<input type="text" name="name"/> </div>
<div>性别:<input type="text" name="sex"> </div>
<div>生日:<input type="text" name="birthday"> </div>
<input type="submit" value="注册"/>
</form>
</body>

注册处理页面

<?php
$uid = $_POST["uid"];
$pwd = $_POST["pwd"];
$name = $_POST["name"];
$sex = $_POST["sex"];
$birthday = $_POST["birthday"];
include ("LZY.class.php");
$db = new LZY();
$sql = "insert into zhuce VALUES ('{$uid}','{$pwd}','{$name}','{$sex}','{$birthday}',0)";
if($db->query($sql,0))
{
 header("location:zhuceyemiandenglu.php");
}
else
{
 echo "注册失败!";
}

登录页面

<body>
<h1>页面登录</h1>
<form action="zcdlchuli.php" method="post">
 <div>用户名:<input type="text" name="uid"/> </div>
 <div>密 码:<input type="password" name="pwd"/></div>
 <div><input type="submit" value="登录"/> </div>
</form>
</body>

注册登录处理页面

<?php
$uid = $_POST["uid"];
$pwd = $_POST["pwd"];
include ("LZY.class.php");
$db = new LZY();
$sql = "select * from zhuce where uid='{$uid}'";
$arr = $db->Query($sql);
if($arr[0][1] == $pwd && !empty($pwd))
{
 if($arr[0][5])
 {
  header("location:zcmain.php");
 }
 else
 {
  echo "该用户尚未通过审核!";
 }
}
else
{
 echo "登录失败!";
} 

注册主界面

<body>
<h1>用户审核</h1>
<table width="100%" border="1" cellpadding="0" cellspacing="0">
 <tr>
  <td>用户名</td>
  <td>姓名</td>
  <td>性别</td>
  <td>生日</td>
  <td>操作</td>
 </tr>
 <?php
 include("LZY.class.php");
 $db = new LZY();
 $sql = "select * from zhuce";
 $arr = $db->Query($sql);
 foreach($arr as $v)
 {
  $str = $v[5]?"<span style='background-color:green'>已通过</span>":"<a href='zctongguo.php?uid={$v[0]}'>通过</a>";
  echo "<tr>
  <td>{$v[0]}</td>
  <td>{$v[2]}</td>
  <td>{$v[3]}</td>
  <td>{$v[4]}</td>
  <td>{$str}</td>
 </tr>";
 }
 ?>
</table>
</body>
</html>

审核通过代码

<?php
$uid = $_GET["uid"];
include("LZY.class.php");
$db = new LZY();
$sql = "update zhuce set isok=1 where uid='{$uid}'";
if($db->Query($sql,0))
{
 header("location:zcmain.php");
}
else
{
 echo "通过失败!";
}

以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,同时也希望多多支持【宜配屋www.yipeiwu.com】!

相关文章

php 使用file_get_contents读取大文件的方法

当我们遇到文本文件体积很大时,比如超过几十M甚至几百M几G的大文件,用记事本或者其它编辑器打开往往不能成功,因为他们都需要把文件内容全部放到内存里面,这时就会发生内存溢出而打开错误,遇到...

总结PHP内存释放以及垃圾回收

引用赋值 $a = 'apple'; $b = &$a; 上述代码中,我将一个字符串赋值给变量a,然后将a的引用赋值给了变量b。显然,这个时候的内存指向应该是这样的: $a -...

php版微信返回用户text输入的方法

本文实例讲述了php版微信返回用户text输入的方法。分享给大家供大家参考,具体如下: 获得用户输入的内容,并发回相同内容 //获取post数据 // $PostData = $HT...

php自定义分页类完整实例

本文实例讲述了php自定义分页类。分享给大家供大家参考,具体如下: <?php header("Content-type:text/html;Charset=utf-8...

php实现的返回数据格式化类实例

本文实例讲述了php实现的返回数据格式化类及其用法,在字符串处理中非常具有实用价值。分享给大家供大家参考。具体方法如下: DataReturn.class.php类文件如下: <...