注册审核通过

逻辑:注册跳转到注册处理页面,数据库要添加注册的信息

注册好了要登录,登录之后跳转到登录处理页面

主页面需要显示数据库表中所有的信息包含审核和通过的,审核的需要提交到审核处理页面

zhuce.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>
<h1>注册</h1>
<form action="zhcchuli.php" method="post">//form表单提交
    <div>用户名:<input type="text" name="uid"/></div>//因为要提交所以需要给text一个name值
    <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>//点击注册页面提交到zhucchuli.php
</form>
</body>


</html>

zhcchuli.php

<?php
$uid=$_POST["uid"];//获取提交来的值
$pwd=$_POST["pwd"];
$name=$_POST["name"];
$sex=$_POST["sex"];
$birthday=$_POST["birthday"];
$sex=$sex=="男"?1:0;//这里要注意,"男"?true:false;这样只能添加性别为男的数据,性别为女的添加不上,因为返回false为空,获取不到,改为1和0可以
include("ChaXun.class.php");
$db=new ChaXun();
$sql="insert into User1 values('{$uid}','{$pwd}','{$name}',{$sex},'{$birthday}',false)";//这里是添加,所以相应的type值要更改
if($db->Query($sql,1))
{
    header("location:zhuce.php");
}

denglu.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>
<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>//点击登录提交到dlchuli.php页面
</form>
</body>
</html>

dlchuli.php

<?php
session_start();//开启session
$uid=$_POST["uid"];
$pwd=$_POST["pwd"];
include("ChaXun.class.php");
$db=new ChaXun();
$sql="select count(*) from User1 where Uid='{$uid}' and Pwd='{$pwd}' and IsOk=true";//查询用户名是否已经存在
$num=$db->StrQuery($sql);
if($num==1)
{
    $_SESSION["uid"]=$uid;//已经的存在的话用session存一下
    header("location:main.php");//用户名密码以及isok为true的登录成功后跳转到主页面
        
}
else
{
    header("location:denglu.php");
}

main.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>
<h1>审核</h1>
<table width="100%" border="1" cellpadding="0" cellspacing="0">//建表显示数据库表中的有信息
<tr>
    <td>姓名</td>
    <td>性别</td>
    <td>生日</td>
    <td>状态</td>
</tr>
    <?php
    include("ChaXun.class.php");
    $db=new ChaXun();
    $sql="select * from User1";
    $attr=$db->Query($sql);
    foreach($attr as $v)
    
    {        $zt="";
            if($v[5])
            {
                $zt="<span style=' background-color:pink; color:white'>已通过</sapn>";
            }
            
            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>

shenhe.php

<?php
$uid=$_GET["uid"];//主键传值用的get方式,这里获取也要用get
include("CHaXun.class.php");
$db=new ChaXun();
$sql="update User1 set IsOk=true where Uid='{$uid}'";//根据传来的主键值更改表中isok为true
//echo $sql;
if($db->Query($sql,1))
{
    header("location:main.php");
}
else
{
    echo"审核失败!";
}

 
原文地址:https://www.cnblogs.com/nannan-0305/p/5520402.html