这篇文章给大家分享的是有关php如何实现注册审核的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。
一.注册功能(zhece.php chuli.php)
1.zhece.php
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> </head> <form method="post" action="chuli.php"> <div > <h3 > 注册页面</h3> <div>用户名:<input type="text" name="users"/></div><br /> <div>密码:<input type="text" name="pwd"/></div><br /> <div>姓名:<input type="text" name="name"/></div><br /> <div>性别:<input type="text" name="sex"/></div><br /> <div>生日:<input type="text" name="birthday"/></div><br /> <input type="submit" value="注册" /> <a href="denglu.php" rel="external nofollow" >已有账号,立即登录</a> </div> </form> <body> </body> </html>
2.chuli.php
<?php $users = $_POST["users"]; $pwd = $_POST["pwd"]; $name= $_POST["name"]; $sex = $_POST["sex"]; $birthday = $_POST["birthday"]; require "DBDA.class.php"; $db = new DBDA(); $sql = "insert into users values ('{$users}','{$pwd}','{$name}',{$sex},'{$birthday}',0)"; if($db->query($sql,0)){ header("location:zhuce.php"); } ?>
二.登录功能(denglu.php login.php )
1.denglu.php
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> </head> <body> <form method="post" action="login.php"> <div > <h3 > 登录页面</h3> <div>用户名:<input type="text" name="users"/></div><br /> <div>密码:<input type="text" name="pwd"/></div><br /> <input type="submit" value="登录" /> <a href="zhuce.php" rel="external nofollow" >没有账号,立即注册</a> </div> </form> </body> </html>
2.login.php
<?php $users = $_POST["users"]; $pwd = $_POST["pwd"]; require "DBDA.class1.php"; $db = new DBDA(); $sql = "select * from users where users = '{$users}'"; $arr = $db->query($sql); //$arr[0][1] 密码 //$arr[0][5] 审核状态 if($arr[0][1] == $pwd && !empty($pwd)) { if($arr[0][5]) { echo "登录成功!"; } else{ echo "审核未通过!"; } } else{ echo "用户名或密码错误!"; } ?>
三.管理员的审核功能(guanliyuan.php tongguo.php chexiao.php)
1.guanliyuan.php
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> </head> <body> <h2>管理员审核</h2> <table width="100%" border="1" cellpadding="0" cellspacing="0"> <tr> <td>用户名</td> <td>密码</td> <td>姓名</td> <td>性别</td> <td>生日</td> <td>操作</td> </tr> <?php require"DBDA.class1.php"; $db = new DBDA(); $sql = "select * from users"; $arr = $db->query($sql); foreach($arr as $v) { $str = ""; if($v[5]) { $str = "<span style='color:green'>已通过</span> <a href='chexiao.php?uid={$v[0]}'>撤销</a>"; } else { $str = "<a href='tongguo.php?uid={$v[0]}'>通过</a>"; } echo "<tr> <td>{$v[0]}</td> <td>{$v[1]}</td> <td>{$v[2]}</td> <td>{$v[3]}</td> <td>{$v[4]}</td> <td>{$str}</td> </tr>"; } ?> </table> </body> </html>
2.tongguo.php
<?php $uid = $_GET["uid"]; require "DBDA.class.php"; $db = new DBDA(); $sql = "update users set isok=1 where uid='{$uid}'"; $db->query($sql,0); header("location:guanliyuan.php");
3.chexiao.php
<?php $uid = $_GET["uid"]; require "DBDA.class.php"; $db = new DBDA(); $sql = "update users set isok=0 where uid='{$uid}'"; $db->query($sql,0); header("location:guanliyuan.php");
感谢各位的阅读!关于“php如何实现注册审核”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,让大家可以学到更多知识,如果觉得文章不错,可以把它分享出去让更多的人看到吧!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。