Home > Backend Development > PHP Tutorial > Detailed introduction on how to use PHP to perform page registration and auditing

Detailed introduction on how to use PHP to perform page registration and auditing

黄舟
Release: 2023-03-06 11:00:01
Original
1725 people have browsed it

This article mainly introduces the method of page registration and review using PHP. It has a very good reference value. Let’s take a look at it with the editor.

After the user registers, there will be this user record. You set an "Audit Status" field in the user table, and the default value is set to "Unknown". "Audit", then you write a few sentences of audit code to make a function. If the audit passes according to your wishes, you can just change the audit status to "Audited". When the user wants to perform various operations, you first determine the audit status field. If it is not audited, block it and give some prompt information. Otherwise, let it go.

Registration page

<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>
Copy after login

##Registration processing page

<?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 "注册失败!";
}
Copy after login

Login page

<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>
Copy after login

Registration login processing page

<?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 "登录失败!";
} 
Copy after login

Registration main interface

<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>
Copy after login

Audit passing code

<?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 "通过失败!";
}
Copy after login
The above is the details of how to use PHP to achieve page registration and auditing The content of the introduction, for more related content, please pay attention to the PHP Chinese website (www.php.cn)!



Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template