注册审核
注册页面代码
<!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="zcchuli.php" method="post"> <div>代号:<input type="text" name="uid" /></div> <div>密码:<input type="text" name="mima" /></div> <div>名字:<input type="text" name="name" /></div> <div>性别:<input type="text" name="sex" /></div> <div>生日:<input type="text" name="shengri" /></div> <input type="submit" value="注册" /> </form> </body> </html>
页面显示

注册处理页面代码
<?php
include("../DBDA.php");
$db= new DBDA();
$uid=$_POST["uid"];
$mima=$_POST["mima"];
$name=$_POST["name"];
$sex=$_POST["sex"]=="男"?1:0;
$sr=$_POST["shengri"];
$sql="insert into ren values('{$uid}','{$mima}','{$name}',{$sex},'{$sr}',false)";
if($db->Query($sql,0))
{
header("location:denglu.php");
}
else
{
echo"注册失败";
}
注册成功进入登录页面,失败显示注册失败
登录页面代码
<!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="dlchuli.php" method="post"> <div>用户名:<input type="text" name="uid"/></div> <div>密码:<input type="text" name="mima"/></div> <input type="submit" value="登录" /> </form> </body> </html>
页面显示

登录处理代码
<?php
session_start();
include("../DBDA.php");
$db= new DBDA();
$uid=$_POST["uid"];
$mima=$_POST["mima"];
$sql="select * from ren where uid='{$uid}'";
$mm=$db->Query($sql);
if($uid!=""&&$mima!="")
{
if($mima==$mm[0][1] && $mm[0][5]==1)
{
$_SESSION["uid"]=$uid;
header("location:shenhe.php");
}
else
{
echo"登录失败或未审核";
}
}
else
{
echo"登录失败";
}
登录成功跳转审核页面,失败显示登录失败或未审核
审核页面代码
<!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>
<?php
session_start();
include("../DBDA.php");
$db=new DBDA();
if(empty($_SESSION["uid"]))
{
header("location:denglu.php");
exit;//跳出判断
}
?>
<h1>审核页面</h1>
</br>
<table width="100%" border="1" cellpadding="0" cellspacing="0">
<tr>
<td>代号</td>
<td>名字</td>
<td>性别</td>
<td>生日</td>
<td>操作</td>
</tr>
<?php
$sql="select * from ren";
$zhi=$db->Query($sql);
foreach($zhi as $v)
{
//处理性别
$sex=$v[3]==1?"男":"女";
//处理操作内容
$caozuo=$v[5]==1?"<span style='background-color:green'>审核通过</span>":"<a href='shchuli.php?uid={$v[0]}'>审核</a>";
echo"<tr>
<td>{$v[0]}</td>
<td>{$v[2]}</td>
<td>{$sex}</td>
<td>{$v[4]}</td>
<td>{$caozuo}</td>
</tr>";
}
?>
</table>
</body>
</html>
页面显示

审核处理页面
<?php
include("../DBDA.php");
$db=new DBDA();
$uid=$_GET["uid"];
$sql="update ren set caozuo=true where uid='{$uid}'";
$db->Query($sql,0);
header("location:shenhe.php");

浙公网安备 33010602011771号