PHP注册审核做法

Posted 小太白

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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="zhucechuli.php" method="post">
    <div>用户名:<input type="text" name="uid" /></div>
    <div>密码:<input type="text" name="pwd" /></div>
    <div>姓名:<input type="text" name="name" /></div>
    <input type="submit" value="注册" />
</form>
</body>
</html>

2.注册处理

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

include("../toupiao/PPO.class.php");
$db = new ppo();

$sql = "insert into users values(‘{$uid}‘,‘{$name}‘,‘{$pwd}‘,‘0‘)";

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

header("location:login.php");

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

4.登陆处理

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

include("../toupiao/PPO.class.php");
$db = new ppo();

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

$attr = $db->Query($sql);

if(!empty($pwd) && !empty($attr) && $attr[0][0] == $pwd)
{
    //密码正确,判断状态
    $szt = "select isok from users where uname=‘{$uid}‘";
    $azt = $db->Query($szt);
    if($azt[0][0])
    { 
        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>
<h1>审核页面</h1>

<table width="100%" border="1" cellpadding="0" cellspacing="0">

    <tr>
        <th>用户名</th>
        <th>密码</th>
        <th>姓名</th>
        <th>状态</th>
    </tr>
    
    <?php
    include("../toupiao/PPO.class.php");
    $db = new ppo();
    
    $sql = "select * from users";
    $attr = $db->Query($sql);
    foreach($attr as $v)
    {
        $zt = $v[3];
        $str = "";
        if($zt)
        {
            $str = "<span style=‘ color:green‘>已通过</span><a href=‘bohui.php?uid={$v[0]}‘>驳回</a>";
        }
        else
        {
            $str = "<a href=‘tongguo.php?uid={$v[0]}‘>通过</a>";
        }
        
        echo "<tr>
        <td>{$v[0]}</td>
        <td>{$v[1]}</td>
        <td>{$v[2]}</td>
        <td>{$v[3]}</td>
        <td>{$str}</td>
    </tr>";
    }
    
    ?>


</table>

</body>
</html>

6.审核通过

<?php

$uid = $_GET["uid"];

include("../toupiao/PPO.class.php");
$db = new ppo();

$sql = "update users set isok=1 where uname=‘{$uid}‘";
$db->Query($sql,0);

header("location:shenhe.php");

7.驳回权限

<?php

$uid = $_GET["uid"];

include("../toupiao/PPO.class.php");
$db = new ppo();

$sql = "update users set isok=0 where uname=‘{$uid}‘";
$db->Query($sql,0);

header("location:shenhe.php");

 

以上是关于PHP注册审核做法的主要内容,如果未能解决你的问题,请参考以下文章

php数据访问-注册审核(重点)

如何用PHP做到页面注册审核

php注册审查

php......注册审核

php 审核注册

PHP 注册审核