首頁 >後端開發 >php教程 >php註冊審核功能介紹

php註冊審核功能介紹

巴扎黑
巴扎黑原創
2017-08-13 11:24:372917瀏覽

這篇文章主要為大家解析了php註冊審核重點,資料進行訪問,具有一定的參考價值,有興趣的小伙伴們可以參考一下

關於審核,如發表文章的審核、員工請假的審核、藥品申請的審核等等,代碼大同小異。

一.註冊功能(zhece.php   chuli.php)

1.zhece.php


#
<!DOCTYPE html>
<html>
 <head>
  <meta charset="UTF-8">
  <title></title>
 </head>
 <form method="post" action="chuli.php">
 <p style="margin:10px 500px"> 
   <h2 >        注册页面</h2>
  <p>用户名:<input type="text" name="users"/></p><br />
  <p>密码:<input type="text" name="pwd"/></p><br />
  <p>姓名:<input type="text" name="name"/></p><br />
  <p>性别:<input type="text" name="sex"/></p><br />
  <p>生日:<input type="text" name="birthday"/></p><br />
  <input type="submit" value="注册" />
  <a href="denglu.php" rel="external nofollow" >已有账号,立即登录</a>
  </p>
 </form>
 <body>
 </body>
</html>

2.chuli.php


<?php

$users = $_POST["users"];
$pwd = $_POST["pwd"];
$name= $_POST["name"];
$sex = $_POST["sex"];
$birthday = $_POST["birthday"];
require "DBDA.class.php";
$db = new DBDA();
$sql = "insert into users values (&#39;{$users}&#39;,&#39;{$pwd}&#39;,&#39;{$name}&#39;,{$sex},&#39;{$birthday}&#39;,0)";
if($db->query($sql,0)){
header("location:zhuce.php"); 
 
}
?>

二.登入功能(denglu.php  login.php ) 

1.denglu.php


#
<!DOCTYPE html>
<html>
 <head>
  <meta charset="UTF-8">
  <title></title>
 </head>
 <body>
  <form method="post" action="login.php">
 <p style="margin:100px 500px"> 
   <h2 >        登录页面</h2>
  <p>用户名:<input type="text" name="users"/></p><br />
  <p>密码:<input type="text" name="pwd"/></p><br />
  <input type="submit" value="登录" />
  <a href="zhuce.php" rel="external nofollow" >没有账号,立即注册</a>
  </p>
 </form>
 </body>
</html>

2.login.php


<?php

$users = $_POST["users"];
$pwd = $_POST["pwd"];
require "DBDA.class1.php";
$db = new DBDA();
$sql = "select * from users where users = &#39;{$users}&#39;";
$arr = $db->query($sql);

//$arr[0][1] 密码
//$arr[0][5] 审核状态


if($arr[0][1] == $pwd && !empty($pwd))
{
 if($arr[0][5])
 {
  echo "登录成功!";
 }
 else{
  echo "审核未通过!";
 }
}
else{
 echo "用户名或密码错误!";
}

?>

 

三.管理者的稽核功能(guanliyuan.php  tongguo.php  chexiao.php)

#1.guanliyuan.php


<!DOCTYPE html>
<html>
 <head>
  <meta 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>
  <td>生日</td>
  <td>操作</td>
 </tr>
 <?php
 require"DBDA.class1.php";
 $db = new DBDA();
 
 $sql = "select * from users";
 $arr = $db->query($sql);
 
 foreach($arr as $v)
 {
  $str = "";
  if($v[5])
  {
   $str = "<span style=&#39;color:green&#39;>已通过</span>
   <a href=&#39;chexiao.php?uid={$v[0]}&#39;>撤销</a>";
  }
  else
  {
   $str = "<a href=&#39;tongguo.php?uid={$v[0]}&#39;>通过</a>";
  }
  
  echo "<tr>
  <td>{$v[0]}</td>
  <td>{$v[1]}</td>
  <td>{$v[2]}</td>
  <td>{$v[3]}</td>
  <td>{$v[4]}</td>
  <td>{$str}</td>
 </tr>";
 }
 ?>
</table>
</body>
</html>

2.tongguo.php


<?php
$uid = $_GET["uid"];
require "DBDA.class.php";
$db = new DBDA();
$sql = "update users set isok=1 where uid=&#39;{$uid}&#39;";
$db->query($sql,0);
header("location:guanliyuan.php");

3.chexiao.php


<?php
$uid = $_GET["uid"];
require "DBDA.class.php";
$db = new DBDA();
$sql = "update users set isok=0 where uid=&#39;{$uid}&#39;";
$db->query($sql,0);
header("location:guanliyuan.php");

以上是php註冊審核功能介紹的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn