Registration Audit for PHP data access

Source: Internet
Author: User

The audit here not only includes the registration audit, to the staff to report to the leadership of the audit, press release of the audit will be used. Here is the registration audit, so we should first build a registered page:

The code is as follows:

"jiagong.php"Method="Post"><div> User name: <input type="text"Name="UID"/></div><div> Password: <input type="Password"Name="pwd"/></div><div> Name: <input type="text"Name="name"/></div><div>Gender: Male:<input type="Radio"Name="Sex"Value="1"/>female:<input type="Radio"Name="Sex"Value="0"/></div><div> Birthday: <input type="text"Name="Birthday"/&GT;&LT;/DIV&GT;&LT;BR/><input type="Submit"Value="Register"/></form>

Processing page:

<?Php$uid=$_post["UID"]; $pwd=$_post["pwd"]; $name=$_post["name"]; $sex=$_post["Sex"]; $birthday= $_post["Birthday"];require"DBDA.class.php"; $db=NewDbda (); $sql="INSERT into used values (' {$uid} ', ' {$pwd} ', ' {$name} ', {$sex}, ' {$birthday} ', 0)";if($db->query ($sql,0) {header ("location:zhuce1.php"); }?>

Then is the login page, and the registration is much the same, but we have to add an audit mechanism, so when you log in not only to determine the user name and password to determine whether the audit passed:

<form action="log.php"Method="Post"><div> User name: <input type="text"Name="UID"/></div><div> Password: <input type="Password"Name="pwd"/></div><input type="Submit"Value="Login"/></form>

Login Processing page:

<?Php$uid= $_post["UID"]; $pwd= $_post["pwd"];require"DBDA.class.php"; $db=NewDbda (); $sql="SELECT * from used where uid= ' {$uid} '"; $arr= $dbquery ($sql); $arr [0][1];//Password$arr [0][5];//Statusif($arr [0][1] = = $pwd &&!empty ($PWD)) {    if($arr [0][5]) {echo"can log in"; }    Else{echo"This account does not pass the audit! "; }}Else{echo"The user name or password is wrong! ";}

The following is the audit function settings, we will not audit the "pass" into a hyperlink, just click "Pass", that is, through the audit. Of course, it can be locked after the lock, after locking is also called the status of failure.

Auditing is required by the administrator, so here is the Administrator's page:

"100%"Border="1"cellpadding="0"cellspacing="0"> <tr> <td> user name </td> <td> password </td> <td> name </td> &L t;td> sex </td> <td> birthdays </td> <td> actions </td> </tr> <?PHP require"DBDA.class.php"; $db=NewDbda (); $sql="SELECT * from used"; $arr= $dbquery ($sql); foreach($arr as$v) {$str=""; if($v [5]) {$str="<span style= ' color:green ' > passed </span><a href= ' suoding.php?uid={$v [0]} ' > Lock </a>"; }        Else{$str="<a href= ' tongguo.php?uid={$v [0]} ' > through </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>

Then the page is passed:

<?  = $_get["uid" "DBDA.class.php "  New  "update used set isok=1 where uid= ' {$uid} '"; $db->query ($ SQL,0); header ("location:guanliyuan.php");

Lock the page and change the isOK to 0:

<?  = $_get["uid" "DBDA.class.php "  New  "update used set isok=0 where uid= ' {$uid} '"; $db->query ($ SQL,0); header ("location:guanliyuan.php");

Eventually:

Registration auditing for PHP data access

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.