標籤:
註冊介面
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>無標題文檔</title></head><body><h1>註冊頁面</h1><form action="zhuceshenhechuli.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="submit" value="註冊" /></div></form></body></html>
View Code
<?phpinclude("DBDA.php");$db = new DBDA();$uid = $_POST["uid"];$pwd = $_POST["pwd"];$name = $_POST["name"];$sex = $_POST["sex"]=="男"?true:false;$sql = "insert into users values(‘{$uid}‘,‘{$pwd}‘,‘{$name}‘,{$sex},false,‘‘)";if($db->Query($sql,0)){ header("location:zhuceshenhe.php");}else{ echo "註冊失敗!";}View Code
登陸介面
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>無標題文檔</title></head><body><h1>登入頁面</h1><form action="zheceshenhechuli2.php" method="post"> <div>使用者名稱:<input type="text" name="uid" /></div> <div>密碼:<input type="password" name="pwd" /></div> <input type="submit" value="登入" /></form></body></html>
View Code
<?phpsession_start();include("DBDA.php");$db = new DBDA();$uid = $_POST["uid"];$pwd = $_POST["pwd"];$sql = "select pwd from users where uid = ‘{$uid}‘";$mima = $db->StrQuery($sql);$sqlzt = "select isok from users where uid=‘{$uid}‘";$zt = $db->StrQuery($sqlzt);if($uid != "" && $pwd != ""){ if($pwd == $mima && $zt==1) { $_SESSION["uid"] = $uid; header("location:zhucechuli3.php"); } else { echo "使用者名稱或密碼錯誤或未審核通過"; }}else{ echo "使用者名稱或密碼錯誤";}View Code
審核介面
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>無標題文檔</title></head><?phpsession_start();include("DBDA.php");$db = new DBDA();if(empty($_SESSION["uid"])){ header("location:zhuceshenhe2.php"); exit;}?><body><h1>審核頁面</h1><table width="100%" border="1" cellpadding="0" cellspacing="0"> <tr> <td>使用者名稱</td> <td>姓名</td> <td>性別</td> <td>操作</td> </tr> <?php $sql = "select * from users"; $attr = $db->Query($sql); foreach($attr as $v) { //處理性別 $sex = $v[3]?"男":"女"; //處理操作 $caozuo = $v[4]?"<span style=‘background-color:green‘>已通過</span>":"<a href=‘zheceshenhechuli3.php?uid={$v[0]}‘>審核</a>"; echo "<tr> <td>{$v[0]}</td> <td>{$v[2]}</td> <td>{$sex}</td> <td>{$caozuo}</td> </tr>"; } ?></table></body></html>View Code
<?phpinclude("DBDA.php");$db = new DBDA();$uid = $_GET["uid"];$sql = "update users set isok=true where uid=‘{$uid}‘";$db->Query($sql,0);header("location:zhuceshenhe3.php");View Code
php 註冊審核