关于审核,如发表文章的审核、员工请假的审核、药品申请的审核等等,代码大同小异。
1.zhece.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
<!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
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
<?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
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
<!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
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
<?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)
1.guanliyuan.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
<!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
1
2
3
4
5
6
7
|
<?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
1
2
3
4
5
6
7
|
<?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" ); |
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持服务器之家。