0523注册审核

注册页面

<h1>注册</h1>
<form action="zcchuli.php" method="post">
<div>用户名:<input type="text" name="yhm" /></div>
<div>密码:<input type="text" name="mm" /></div>
<div>姓名:<input type="text" name="xm" /></div>
<div>性别:<input type="text" name="xb" /></div>
<div>生日:<input type="text" name="sr" /></div>
<input type="submit" value="注册" />

</form>

注册处理页面

<?php
$uid=$_POST["yhm"];
$pwd=$_POST["mm"];
$name=$_POST["xm"];
$sex=$_POST["xb"];
$sr=$_POST["sr"];
if($sex=="男")
$sex=1;
else
$sex=0;
include("../DBDA.php");
$db=new DBDA();
$sql="insert into dl values(false,'{$sr}',{$sex},'{$name}','{$pwd}','{$uid}')";
if($db->Query($sql,0))
{
header("location:denglu.php");
}

登录页面

<h1>登录</h1>
<form action="dlchuli.php" method="post">
<div>用户名<input type="text" name="yhm" /></div>
<div>密码<input type="text" name="mm" /></div>
<input type="submit" value="登录" />
</form>

登录处理页面

<?php
session_start();
$uid=$_POST["yhm"];
$pwd=$_POST["mm"];
include("../DBDA.php");
$db=new DBDA();
$sql="select count(*) from dl where uid='{$uid}' and pwd='{$pwd}' and isok=true";
$jg=$db->StrQuery($sql);
if($jg==1)
{
$_SESSION["uid"]=$uid;
header("location:zhu.php");
}
else
{
header("location:denglu.php");
}

主页面

<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 dl";
$jieguo=$db->Query($sql);
foreach($jieguo as $v)
{
$isok="";
if($v[0])
{
$isok="审核通过<a href='zxchuli.php?uid={$v[5]}'>注销</a>";
}
else
{
$isok="<a href='shchuli.php?uid={$v[5]}'>审核</a>";
}
echo"<tr>
<td>{$v[3]}</td>
<td>{$v[2]}</td>
<td>{$v[1]}</td>
<td>{$isok}</td>
</tr>";
}
?>
</table>

审核处理页面

<?php
$uid=$_GET["uid"];
include("../DBDA.php");
$db=new DBDA();
$sql="update dl set isok=true where uid='{$uid}'";
if($db->Query($sql,0))
{
header("location:zhu.php");
}
else
{
echo"审核失败";
}

注销处理页面

<?php
$uid=$_GET["uid"];
include("../DBDA.php");
$db=new DBDA();
$sql="update dl set isok=false where uid='{$uid}'";
if($db->Query($sql,0))
{
header("location:zhu.php");
}
else
{
echo"注销失败";
}

原文地址:https://www.cnblogs.com/wcc731546227/p/5519973.html