關于審核,如發表文章的審核、員工請假的審核、藥品申請的審核等等,代碼大同小異。
一.注冊功能(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 style="margin:10px 500px"> <h2 > 注冊頁面</h2> <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 style="margin:100px 500px"> <h2 > 登錄頁面</h2> <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> <h1>管理員審核</h1> <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");
以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持。
【網站聲明】本站除付費源碼經過測試外,其他素材未做測試,不保證完整性,網站上部分源碼僅限學習交流,請勿用于商業用途。如損害你的權益請聯系客服QQ:2655101040 給予處理,謝謝支持。