php注册 及审核练习

1.注册界面
<!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="Ytianjia.php" method="post">
<div>用户名:<input type="text" name="uid"/></div>
<div>密 码:<input type="text" name="pwd"/></div>
<div>
性 别:
<input type="radio" name="sxe" value="1"/>男
<input type="radio" name="sxe" value="0"/>女
</div>
<div>姓 名:<input type="text" name="name"/></div>
<div>生 日:<input type="text" name="bday"/></div>
<input type="hidden" name="isok" value="0"/>
<div>
<input type="submit" value="注册"/>
<a href="Ydengru.php"><input type="button" value="登入"/></a>
</div>
</form>
</body>
</html>
2.写入数据库:Ytianjia.php
<?php
$uid =$_POST["uid"];
$pwd =$_POST["pwd"];
$name =$_POST["name"];
$sxe =$_POST["sxe"];
$bday =$_POST["bday"];
$isok =$_POST["isok"];
require "Wang.class.php";
$db = new Wang();
$sql = "insert into yonghu values('{$uid}','{$pwd}','{$name}',{$sxe},'{$bday}',{$isok})";
if($db->query($sql,0))
{
header("location:Yzhuce.php");
}
3.用户登入页面Ydengru.php
<!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>
<h2>用户登入</h2>
<form action="Ydrcaozuo.php" method="post">
<div>用户名:<input type="text" name="uid"/></div>
<div>密 码:<input type="password" name="pwd" /></div>
<input type="submit" value="登入"/><input type="button" value="忘记密码"/>
</form>
</body>
</html>
4.登入查询操作页面 Ydrcaozuo.php
<?php
$uid =$_POST["uid"];
$pwd =$_POST["pwd"];
require "Wang.class.php";
$db = new Wang();
$sql ="select * from yonghu where uid='{$uid}'";
$arr = $db->query($sql);
$arr[0][1];
$arr[0][5];
if($arr[0][1]==$pwd && !empty($pwd))
{
if($arr[0][5])
{
echo "登入成功!";
}
else
{
echo "没有审核";
}
}
else
{
echo "用户名或密码不对!";
}
5.管理员审核页面
<!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>
<table border="1">
<tr>
<td>用户名</td>
<td>密码</td>
<td>姓名</td>
<td>性别</td>
<td>生日</td>
<td>操作</td>
</tr>
<?php
require "Wang.class.php";
$db = new Wang();
$sql ="select * from yonghu ";
$arr =$db->query($sql);
foreach($arr as $v)
{
if($v[5])
{
$str ="<span style='color:green'>已通过</span><a href='Ysuoding.php?uid={$v[0]}'>锁定</a>";
}
else
{
$str ="<a href='Yshenhe.php?uid={$v[0]}'>未审核</a>";
}
echo"
<tr>
<td>{$v[0]}</td>
<td>{$v[1]}</td>
<td>{$v[2]}</td>
<td>{$v[3]}</td>
<td>{$v[4]}</td>
<td>{$str}</td>
</tr>";
}
?>
</table>
</body>
</html>
6.处理审核页面
<?php
$uid = $_GET["uid"];
require "Wang.class.php";
$db = new Wang();
$sql ="update yonghu set isok=1 where uid='{$uid}'";
$db->query($sql,0);
header("location:Yguanli.php");
6.锁定处理页面
<?php
$uid = $_GET["uid"];
require "Wang.class.php";
$db = new Wang();
$sql ="update yonghu set isok=0 where uid='{$uid}'";
$db->query($sql,0);
header("location:Yguanli.php");
浙公网安备 33010602011771号