微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

PHP编程:php注册审核重点解析数据访问

PHP注册审核重点解析(数据访问)》要点:
本文介绍了PHP注册审核重点解析(数据访问),希望对您有用。如果有疑问,可以联系我们。

关于审核,如发表文章的审核、员工请假的审核、药品申请的审核等等,代码大同小异.PHP学习

一.注册功能(zhece.PHP   chuli.PHP)

1.zhece.PHP

php注册审核重点解析(数据访问)

<!DOCTYPE html>
<html>
 <head>
  <Meta charset="UTF-8">
  <title></title>
 </head>
 <form method="post" action="chuli.PHP">
 <div style="margin:10px 500px"> 
   <h2 >        注册页面</h2>
  <div>用户名:<input type="text" name="users"/></div><br />
  <div>密码:<input type="text" name="pwd"/></div><br />
  <div>姓名:<input type="text" name="name"/></div><br />
  <div>性别:<input type="text" name="sex"/></div><br />
  <div>生日:<input type="text" name="birthday"/></div><br />
  <input type="submit" value="注册" />
  <a href="denglu.PHP" rel="external nofollow" >已有账号,立即登录</a>
  </div>
 </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 ('{$users}','{$pwd}','{$name}',{$sex},'{$birthday}',0)";
if($db->query($sql,0)){
header("location:zhuce.PHP"); 
 
}
?>

二.登录功能(denglu.PHP  login.PHP

php注册审核重点解析(数据访问)

1.denglu.PHP

<!DOCTYPE html>
<html>
 <head>
  <Meta charset="UTF-8">
  <title></title>
 </head>
 <body>
  <form method="post" action="login.PHP">
 <div style="margin:100px 500px"> 
   <h2 >        登录页面</h2>
  <div>用户名:<input type="text" name="users"/></div><br />
  <div>密码:<input type="text" name="pwd"/></div><br />
  <input type="submit" value="登录" />
  <a href="zhuce.PHP" rel="external nofollow" >没有账号,立即注册</a>
  </div>
 </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 = '{$users}'";
$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)

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='color:green'>已通过</span>
   <a href='chexiao.PHP?uid={$v[0]}'>撤销</a>";
  }
  else
  {
   $str = "<a href='tongguo.PHP?uid={$v[0]}'>通过</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='{$uid}'";
$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='{$uid}'";
$db->query($sql,0);
header("location:guanliyuan.PHP");

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持编程之家.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐