注册审核例题

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>
    
   <form action="loginchuli.php" method="post">
       <div>用户名:<input type="text" name="uid" /></div>
    <div>密码:<input type="text" name="pwd" /></div>
    
    <div><input type="submit" value="登录" /></div>
   </form>
    
    
</body>
</html>

2.登录处理页面

<?php
$uid = $_POST["uid"];
$pwd = $_POST["pwd"];

include("../DBDA.class.php");
$db = new DBDA();

$sql = "select pwd from users where uid='{$uid}'";

$mm = $db->StrQuery($sql);

if($pwd != "" && $pwd==$mm)
{
    $ssh = "select isok from users where uid='{$uid}'";
    $n = $db->StrQuery($ssh);
    if($n==1)
    {
        header("location:main.php");
    }
    else
    {
        echo "该账号还未经过审核";
    }
}
else
{
    echo "用户名或密码错误";
}

3.主页面

<!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>

<table width="100%" border="1" cellpadding="0" cellspacing="0">
    <tr>
        <td>用户名</td>
        <td>姓名</td>
        <td>状态</td>
    </tr>
 
    <?php
    include("../DBDA.class.php");
    $db = new DBDA();
    
    $sql = "select * from users";
    $attr = $db->Query($sql);    
    
    foreach($attr as $v)
    {
        //处理状态
        $zt = "";
        if($v[5]==1)
        {
            $zt = "<span style='color:green'>已通过</span>";
        }
        else
        {
            $zt = "<a href='shenhe.php?u={$v[0]}'>审核</a>";
        }
        
        echo "<tr><td>{$v[0]}</td><td>{$v[2]}</td><td>{$zt}</td></tr>";
    }
    ?>

 

    
</table>

</body>
</html>

4.审核页面

<?php
include("../DBDA.class.php");
$db = new DBDA();

$uid = $_GET["u"];

$sql = "update users set isok=1 where uid='{$uid}'";

$db->Query($sql,0);

header("location:main.php");

 

posted on 2016-11-09 19:55  向前看!明天会更好!  阅读(75)  评论(0编辑  收藏  举报