注册审核
Posted 颠覆整个世界
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了注册审核相关的知识,希望对你有一定的参考价值。
管理员通过注册审核来控制人员的注册,登录及相关权限,多用在办公系统
注册页面:
<body> <h1>注册页面</h1> <form action="chuli.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> <div><input type="submit" value="注册" /></div> </form> </body>
chuli.php页面:
<?php $uid = $_POST["uid"]; $pwd = $_POST["pwd"]; $name = $_POST["name"]; $sex = $_POST["sex"]; $birthday = $_POST["birthday"]; $sex = $sex =="男"?1:0; include("../DBDA.class.php"); $db = new DBDA(); $sql = "insert into Users values(\'{$uid}\',\'{$pwd}\',\'{$name}\',\'{$sex}\',\'{$birthday}\',false)"; if($db->Query($sql,0)) { header("location:log.php"); } else { }
注册成功后直接跳转到登录页面
登录页面;
<body> <h1>登录</h1> <form action="logchuli.php" method="post"> <div>用户名:<input type="text" name="uid" /></div> <div>密码:<input type="text" name="pwd" /></div> <div><input type="submit" value="登录" /></div> </form> </body>
logchuli.php:
<?php session_start(); $uid = $_POST["uid"]; $pwd = $_POST["pwd"]; include("../DBDA.class.php"); $db = new DBDA(); $sql = "select count(*) from Users where uid =\'{$uid}\' and pwd=\'{$pwd}\' and isok=true"; $z = $db->StrQuery($sql); if($z ==1) { $_SESSION["uid"] = $uid; header("location:main.php"); } else { header("location:log.php"); }
审核成功后,可以登录,否则不可以登录
主页面;
<body> <h1>主页面</h1> <table width="100%" border="1" cellpadding="0" cellspacing="0"> <tr> <td>姓名</td> <td>性别</td> <td>生日</td> <td>审核状态</td> </tr> <?php include("../DBDA.class.php"); $db = new DBDA(); $sql = "select * from users"; $attr = $db->Query($sql); foreach($attr as $v) { $zt = ""; //处理状态 if($v[5]) { $zt = "<span style=\'color:green\'>已通过</span><a href=\'quxiao.php?uid={$v[0]}\'>取消</a>"; } else { $zt = "<a href=\'shenhe.php?uid={$v[0]}\'>审核</a>"; } echo "<tr> <td>{$v[2]}</td> <td>{$v[3]}</td> <td>{$v[4]}</td> <td>{$zt}</td> </tr>"; } ?> </table> </body>
shenhe.php页面:(未进行审核点击可进行审核)
<?php $uid = $_GET["uid"]; include("../DBDA.class.php"); $db = new DBDA(); $sql = "update users set isok=true where uid = \'{$uid}\'"; if($db->Query($sql,0)) { header("location:main.php"); } else { echo "审核失败"; }
quxiao.php页面:(审核成功后进行取消)
<?php $uid = $_GET["uid"]; include("../DBDA.class.php"); $db = new DBDA(); $sql = "update users set isok=false where uid = \'{$uid}\'"; if($db->Query($sql,0)) { header("location:main.php"); } else { echo "取消失败"; }
以上是关于注册审核的主要内容,如果未能解决你的问题,请参考以下文章