PHP 注册审核

Posted Yao1101

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PHP 注册审核相关的知识,希望对你有一定的参考价值。

注册页面

<body>
<h1>注册</h1>
<form action="zcchuli.php" method="post">
    <div>用户名:<input type="text" name="uid" /></div>
    <div>密码:<input type="text" name="pwd" /></div>
    <div>姓名:<input type="text" name="name" /></div>
    <div>性别:<input type="text" name="sex" /></div>
    <div>生日:<input type="text" name="birthday" /></div>
    <div><input type="submit" value="注册" /></div>
</form>
</body>
</html>

注册处理页面

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


$sex = $sex == "男"?true:false;

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

$sql = "insert into Users values(‘{$uid}‘,‘{$pwd}‘,‘{$name}‘,{$sex},‘{$birthday}‘,false)";

if($db->Query($sql,0))
{
    header("location:zhuce.php");
}

登录页面

<body>
<h1>登录</h1>
<form action="dlchuli.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>

登录处理页面

<?php
session_start();

$uid = $_POST["uid"];
$pwd = $_POST["pwd"];

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

$sql = "select count(*) from Users where Uid = ‘{$uid}‘ and Pwd= ‘{$pwd}‘ and Isok=true";

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

if($z == 1)
{
    $_SESSION["uid"]=$uid;
    header("location:main.php");
}
else
{
    header("location:login.php");
}

审核撤销页面

<body>
<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 Users";
    
    $attr = $db->Query($sql);
    
    foreach($attr as $v)
    {
        //处理状态
        $zt = "";
        if($v[5])
        {
            $zt = "<span style=‘background-color:green;color:white‘>已通过</span><a href=‘chexiao.php?uid={$v[0]}‘>撤销</a>";
        }
        else
        {
            $zt = "<a href=‘shenhe.php?uid={$v[0]}‘>审核</a>";
        }
        
        echo "<tr>
        <td>{$v[2]}</td>
        <td>{$v[3]}</td>
        <td>{$v[4]}</td>
        <td>{$zt}</td>
        </tr>";
    }
    
    ?>
</table>
</body>
</html>

审核处理页面

<?php

$uid = $_GET["uid"];

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

$sql = "update Users set Isok=true where Uid=‘{$uid}‘";

if($db->Query($sql,0))
{
    header("location:main.php");
}
else
{
    echo "审核失败!";
}

撤销处理页面

<?php
$uid = $_GET["uid"];

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

$sql = "update Users set Isok=false where Uid=‘{$uid}‘";

if($db->Query($sql,0))
{
    header("location:main.php");
}
else
{
    echo "撤销失败!";
}

 

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

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

php注册审查

php......注册审核

php 审核注册

PHP 注册审核

php 之 注册审核(0523)