Rumah >pembangunan bahagian belakang >tutorial php >深入理解用PHP实现页面注册审核

深入理解用PHP实现页面注册审核

迷茫
迷茫asal
2017-03-26 10:46:571194semak imbas

注册页面

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

 

注册处理页面

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

include ("LZY.class.php");
$db = new LZY();
$sql = "insert into zhuce VALUES (&#39;{$uid}&#39;,&#39;{$pwd}&#39;,&#39;{$name}&#39;,&#39;{$sex}&#39;,&#39;{$birthday}&#39;,0)";

if($db->query($sql,0))
{
    header("location:zhuceyemiandenglu.php");
}
else
{
    echo "注册失败!";
}

登录页面

<body>
<h1>页面登录</h1>
<form action="zcdlchuli.php" method="post">
    <p>用户名:<input type="text" name="uid"/> </p>
    <p>密  码:<input type="password" name="pwd"/></p>
    <p><input type="submit" value="登录"/> </p>
</form>


</body>

  

注册登录处理页面

<?php
$uid = $_POST["uid"];
$pwd = $_POST["pwd"];
include ("LZY.class.php");
$db = new LZY();
$sql = "select * from zhuce where uid=&#39;{$uid}&#39;";
$arr = $db->Query($sql);

if($arr[0][1] == $pwd && !empty($pwd))
{
    if($arr[0][5])
    {
        header("location:zcmain.php");
    }
    else
    {
        echo "该用户尚未通过审核!";
    }
}
else
{
    echo "登录失败!";
}

注册主界面

<body>

<h1>用户审核</h1>

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

    <tr>
        <td>用户名</td>
        <td>姓名</td>
        <td>性别</td>
        <td>生日</td>
        <td>操作</td>
    </tr>

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

    $sql = "select * from zhuce";
    $arr = $db->Query($sql);

    foreach($arr as $v)
    {
        $str = $v[5]?"<span style=&#39;background-color:green&#39;>已通过</span>":"<a href=&#39;zctongguo.php?uid={$v[0]}&#39;>通过</a>";

        echo "<tr>
    	<td>{$v[0]}</td>
        <td>{$v[2]}</td>
        <td>{$v[3]}</td>
        <td>{$v[4]}</td>
        <td>{$str}</td>
    </tr>";
    }

    ?>

</table>

</body>
</html>

 

审核通过代码

<?php
$uid = $_GET["uid"];
include("LZY.class.php");
$db = new LZY();

$sql = "update zhuce set isok=1 where uid=&#39;{$uid}&#39;";
if($db->Query($sql,0))
{
    header("location:zcmain.php");
}
else
{
    echo "通过失败!";
} 

Atas ialah kandungan terperinci 深入理解用PHP实现页面注册审核. Untuk maklumat lanjut, sila ikut artikel berkaitan lain di laman web China PHP!

Kenyataan:
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn