<body> <h1>注册</h1> <form action="zcchuli.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>
注册处理<?php $uid = $_POST["uid"]; $pwd = $_POST["pwd"]; $name = $_POST["name"]; $sex = $_POST["sex"]; $birthday = $_POST["birthday"]; $sex = $sex == "男"?true:false; include("../DBDA.php"); $db = new DBDA(); $sql = "insert into Users values(‘{$uid}‘,‘{$pwd}‘,‘{$name}‘,{$sex},‘{$birthday}‘,false)"; if($db->Query($sql,0)) { header("location:zhuce.php"); }
<body> <h1>登录</h1> <form action="dlchuli.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>
登录处理页面<?php session_start(); $uid = $_POST["uid"]; $pwd = $_POST["pwd"]; include("../DBDA.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:login.php"); }
审核处理页面 <?php $uid = $_GET["uid"]; include("../DBDA.php"); $db = new DBDA(); $sql = "update Users set Isok=true where Uid=‘{$uid}‘"; if($db->Query($sql,0)) { header("location:main.php"); } else { echo "审核失败!"; }
<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.php"); $db = new DBDA(); $sql = "select * from Users"; $attr = $db->Query($sql); foreach($attr as $v) { //处理状态 $zt = ""; if($v[5]) { $zt = "<span style=‘background-color:green;color:white‘>已通过</span><a href=‘chexiao.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>
撤销处理页面 <?php $uid = $_GET["uid"]; include("../DBDA.php"); $db = new DBDA(); $sql = "update Users set Isok=false where Uid=‘{$uid}‘"; if($db->Query($sql,0)) { header("location:main.php"); } else { echo "撤销失败!"; }
时间: 2024-10-12 19:47:46