Logic: Register jump to register processing page, database to add registered information
Sign up to log in and jump to the login processing page after logging in
The main page needs to display all the information in the database table that is audited and passed, and the audit needs to be submitted to the Review processing page
zhuce.php
<!DOCTYPE HTML Public "-//W3C//DTD XHTML 1.0 transitional//en" "http://www.w3.org/TR/xhtml1/DTD/ Xhtml1-transitional.dtd "><HTMLxmlns= "http://www.w3.org/1999/xhtml"><Head><Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8" /><title>Untitled Document</title></Head><Body><H1>Registered</H1><formAction= "zhcchuli.php"Method= "POST">//form form submission <Div>User name:<inputtype= "text"name= "UID"/></Div>//Because I want to commit, I need to give text a name value <Div>Password:<inputtype= "text"name= "pwd"/></Div> <Div>Name:<inputtype= "text"name= "Name"/></Div> <Div>Gender:<inputtype= "text"name= "Sex"/></Div> <Div>Birthday:<inputtype= "text"name= "Birthday"/></Div> <Div><inputtype= "Submit"value= "Register" /></Div>//Click on the registration page to submit to zhucchuli.php </form></Body></HTML>
zhcchuli.php
<?PHP$uid=$_post["UID"]; //Get the value submitted $pwd=$_post["PWD"];$name=$_post["Name"];$sex=$_post["Sex"];$birthday=$_post["Birthday"];$sex=$sex= = "Male"? 1:0; //Here to note, "male"? True:false; This can only add sex for the male data, the gender for the female is not added, because the return false is empty, gets not, instead, 1 and 0 include("ChaXun.class.php");$db=NewChaxun ();$sql= "INSERT into User1 values (' {$uid}‘,‘{$pwd}‘,‘{$name}‘,{$sex},‘{$birthday} ', False) '; //Here is add, so the corresponding type value to change if($db->query ($sql, 1)){ Header("location:zhuce.php");}
denglu.php
<!DOCTYPE HTML Public "-//W3C//DTD XHTML 1.0 transitional//en" "http://www.w3.org/TR/xhtml1/DTD/ Xhtml1-transitional.dtd "><HTMLxmlns= "http://www.w3.org/1999/xhtml"><Head><Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8" /><title>Untitled Document</title></Head><Body><formAction= "dlchuli.php"Method= "POST"><Div>User name:<inputtype= "text"name= "UID" /></Div><Div>Password:<inputtype= "text"name= "pwd" /></Div><Div><inputtype= "Submit"value= "Login" /></Div>//Click Login to submit to dlchuli.php page </form></Body></HTML>
dlchuli.php
<?PHPSession_Start(); //Open session $uid=$_post["UID"];$pwd=$_post["PWD"];include("ChaXun.class.php");$db=NewChaxun ();$sql= "SELECT count (*) from User1 where uid= ' {$uid} ' and pwd= ' {$pwd} ' and Isok=true '; //Query whether the user name already exists $num=$db->strquery ($sql);if($num==1){ $_session["UID"]=$uid; //already exist, save it with a session .Header("location:main.php"); //user name password and isOK to true after successful login jump to main page }Else{ Header("location:denglu.php");}
main.php
<!DOCTYPE HTML Public "-//W3C//DTD XHTML 1.0 transitional//en" "http://www.w3.org/TR/xhtml1/DTD/ Xhtml1-transitional.dtd "><HTMLxmlns= "http://www.w3.org/1999/xhtml"><Head><Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8" /><title>Untitled Document</title></Head><Body><H1>Audit</H1><Tablewidth= "100%"Border= "1"cellpadding= "0"cellspacing= "0">//Build a table showing information in a database table <TR> <TD>Name</TD> <TD>Gender</TD> <TD>Birthday</TD> <TD>State</TD></TR> <?php include ("ChaXun.class.php"); $db =new Chaxun (); $sql = "SELECT * from User1"; $attr = $db->query ($sql); foreach ($attr as $v) {$zt = ""; if ($v [5]) {$zt = "<span style= ' Background-color:pink; Color:white ' > Passed </sapn>"; } else {$zt = "<a href= ' shenhe.php?uid={$v [0]} ' > Audit </a> "; //Audit by primary key pass value } echo "<tr> <td>{$v [2]}</td> <td>{$v [3]}</td> <td>{$v [4 ]}</td> <td>{$zt}</td> </tr> "; } ?></Table></Body></HTML>
shenhe.php
<?PHP$uid=$_get["UID"]; //Primary key for the value of the Get method, here get also use get include("CHaXun.class.php");$db=NewChaxun ();$sql= "Update User1 set isok=true where uid= ' {$uid}‘";//isOK is true based on the incoming primary key value change table//echo $sql;if($db->query ($sql, 1)){ Header("location:main.php");}Else{ Echo"Audit Failed!" ";}
Registration Audit Pass