首页 > 开发 > PHP > 正文

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

2024-05-04 22:47:33
字体:
来源:转载
供稿:网友

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

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

1.zhece.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 ) 

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 "用户名或密码错误!";}?>            
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表