The first is to register
<form action="dlchuli.php" method="post"> <div>用户名:<input type="text" name="uid" /></div> <div>密码:<input type="text" name="pwd" /></div> <div>姓名:<input type="text" name="uname" /></div> <div>性别:<input type="radio" name="sex" id="nan" value="1">男</label> <label class="btn btn-primary"><input type="radio" name="sex" id="nv" value="0">女</label> </div> <div>生日:<input type="text" name="birthday" /></div> <div>工号:<input type="text" name="gcode"></div> <input type="submit" value="注册" /> </form>
dlchuli.php page
<?php $uid = $_POST["uid"]; $pwd = $_POST["pwd"]; $uname = $_POST["uname"]; $sex = $_POST["sex"]; $birthday = $_POST["birthday"]; $gcode = $_POST["gcode"]; require_once "./lib/DBDA.class.php"; $db = new DBDA(); $sql = "insert into user values('{$uid}','{$pwd}','{$uname}','{$sex}','{$birthday}','{$gcode}',0)"; $result = $db->query($sql,1); if($result){ echo "Registration succeeded"; }else{ echo "Registration failed"; }
Login next
<body> <form action="./denglucl.php" method="post"> 用户名:<input type="text" name="uid" /> 密码:<input type="text" name="pwd" /> <input type="submit" value="登录"/> </form> </body>
Login processing page
<?php $uid = $_POST["uid"]; $pwd = $_POST["pwd"]; require_once "./lib/DBDA.class.php"; $db = new DBDA(); $sql = "select * from user where uid = '{$uid}'";// $arr = $db->query($sql); if($arr[0][1] == $pwd && !empty($pwd)){ if($arr[0][6]){//When judging the verification password, the isok column is 1? If yes, it will pass, if not, it will prompt "Failed to pass the review" header("location:shenhe.php"); }else{ echo "The user has not been approved!"; } }else{ echo "Login failed!"; }
If it fails to pass the review, enter through the review page and click Pass
<table width="100%" border="1" cellpadding="0" cellspacing="0"> <tr> <td>Username</td> <td>姓名</td> <td>Gender</td> <td>Birthday</td> <td>操作</td> </tr> <?php require_once "./lib/DBDA.class.php"; $db = new DBDA(); $sql = "select * from user"; $arr = $db->query($sql); foreach($arr as $v){ $str = $v[6]?"<span style='background-color:green'>已通过</span>":"<a href='tongguo.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>"; } ?>
<a href='tongguo.php?uid={$v[0]}'>Pass </a> here to pass the primary key value to the processing page through the get method
<?php $uid = $_GET["uid"]; require_once "./lib/DBDA.class.php"; $db = new DBDA(); $sql = "update user set isok=1 where uid='{$uid}'"; $result = $db->query($sql,1); header("location:shenhe.php");
After returning, enter the username and password again to log in