We can not log in directly after registration, only after the administrator audit to be able to log in, of course, the administrator can also revoke the audit. The audit is used in the Office system more.
Registration page:
<H1>Registered</H1><formAction= "zcchuli.php"Method= "POST"><Div>User name:<inputtype= "text"name= "UID" /></Div><BR/><Div>Password: <inputtype= "Password"name= "pwd" /></Div><BR/><Div>Name: <inputtype= "text"name= "Name" /></Div><BR/><Div>Gender: <inputtype= "text"name= "Sex" /></Div><BR/><Div>Birthday: <inputtype= "text"name= "Birthday" /></Div><BR/><Div><inputtype= "Submit"value= "Register" /></form>
View Code
Registration Processing page:
<?PHP$uid=$_post["UID"];$pwd=$_post["PWD"];$name=$_post["Name"];$sex=$_post["Sex"];$birthday=$_post["Birthday"];//dealing with gender$sex=$sex= = "Male"?true:false;//processing time, formatting the time$time=Date("Y-m-d h:i:s");include(".. /db.class.php ");$db=NewDB ();$sql= "INSERT into Users values (' {$uid}‘,‘{$pwd}‘,‘{$name}‘,{$sex},‘{$birthday}‘,‘{$time} ', False) ';Echo $sql;if($db->query ($sql, 1)){ Header("location:zhuce.php"); }Else{ Echo"Registration failed!" "; }
View Code
Login page:
<H1>Login</H1><formAction= "loginchuli.php"Method= "POST"><Div>User name:<inputtype= "text"name= "UID" /></Div><BR/><Div>Password: <inputtype= "Password"name= "pwd" /></Div><BR/><Div><inputtype= "Submit"value= "Login" /></Div></form>
View Code
Login Processing page:
<?PHPSession_Start();$uid=$_post["UID"];$pwd=$_post["PWD"];include(".. /db.class.php ");$db=NewDB ();$sql= "SELECT count (*) from the Users where Uid = ' {$uid} ' and Pwd = ' {$pwd} ' and IsOk = True ';//user name, password, and audit status are all right to log on$r=$db->strquery ($sql);if($r==1){ $_session["UID"] =$uid;//save user name to session Header("location:main.php"); }Else{ Header("location:login.php"); }
View Code
Main Page (Audit page):
<?PHPSession_Start();if(Empty($_session["UID"])){ Header("location:login.php"); }$uid=$_session["UID"];?>PHPinclude(".. /db.class.php ");$db=NewDB ();$sql= "SELECT * from the users ORDER by time Desc";//Sort by the registration time in descending order, so the new registration will be on the top$attr=$db->query ($sql);foreach($attr as $v){ //Processing Status $zt= ""; if($v[6]) { $zt= "<span style= ' Background-color:green; Color:white ' > Passed </span> <a href= ' chexiao.php?uid={$v[0]} ' > Undo </a> "; } Else { $zt= "<a href= ' shenhe.php?uid={$v[0]} ' > Audit </a> ";//Get pass Value } Echo"<tr><td>{$v[2]}</td> <td>{$v[3]}</td> <td>{$v[4]}</td> <td>{$v[5]}</td> <td>{$zt}</td></tr> "; }?></table>
View Code
Audit Processing page:
<?PHP$uid=$_get["UID"];include(".. /db.class.php ");$db=NewDB ();$sql= "Update users set IsOk = TRUE where uid= ' {$uid}‘";if($db->query ($sql, 1)){ Header("location:main.php");}Else{ Echo"Audit Failed!" "; }
View Code
Undo page:
<?PHP$uid=$_get["UID"];include(".. /db.class.php ");$db=NewDB ();$sql= "Update users set IsOk = False where uid= ' {$uid}‘";if($db->query ($sql, 1)){ Header("location:main.php");}Else{ Echo"Undo Failed!" "; }
View Code
Php...... Registration Audit