Registration page
<body >
<form action= "zhucechuli.php" method= "POST" >
<div> Username: <input type= "text" name= "UID"/> </div>
<div> Password: <input type= "text" name= "pwd"/> </div>
<div> Name: <input type= "text" name= "name"/> </div>
<div> Sex: <input type= "text" name= "Sex" > </div>
<div> Birthdays: <input type= "text" name= "Birthday" > </div>
<input type= "Submit" value= "register"/>
</form>
</body>
Registration Processing Page
<?php
$uid = $_post["UID"];
$pwd = $_post["pwd"];
$name = $_post["name"];
$sex = $_post["Sex"];
$birthday = $_post["Birthday"];
Include ("LZY.class.php");
$db = new LZY ();
$sql = "INSERT INTO Zhuce VALUES (' {$uid} ', ' {$pwd} ', ' {$name} ', ' {$sex} ', ' {$birthday} ', 0)";
if ($db->query ($sql, 0))
{
Header ("location:zhuceyemiandenglu.php");
}
Else
{
echo "Registration failed! ";
}
Login Page
<body>
<form action= "zcdlchuli.php" method= "POST" >
<div> Username: <input type= "text" name= "UID"/> </div>
<div> Password: <input type= "password" name= "pwd"/></div>
<div><input type= "Submit" value= "Login"/> </div>
</form>
</body>
Register Login Processing Page
<?php
$uid = $_post["UID"];
$pwd = $_post["pwd"];
Include ("LZY.class.php");
$db = new LZY ();
$sql = "SELECT * from Zhuce where uid= ' {$uid} '";
$arr = $db->query ($sql);
if ($arr [0][1] = = $pwd &&!empty ($pwd))
{
if ($arr [0][5])
{
Header ("location:zcmain.php");
}
Else
{
echo "The user has not passed the review!" ";
}
}
Else
{
echo "Login failed! ";
}
Register the main interface
<body>
<table width= "100%" border= "1" cellpadding= "0" cellspacing= "0" >
<tr>
<td> User name </td>
<td> name </td>
<td> Sex </td>
<td> Birthdays </td>
<td> Operations </td>
</tr>
<?php
Include ("LZY.class.php");
$db = new LZY ();
$sql = "SELECT * from Zhuce";
$arr = $db->query ($sql);
foreach ($arr as $v)
{
$STR = $v [5]? " <span style= ' Background-color:green ' > Passed </span> ":" <a href= ' zctongguo.php?uid={$v [0]} ' > via </a > ";
echo "<tr>
<td>{$v [0]}</td>
<td>{$v [2]}</td>
<td>{$v [3]}</td>
<td>{$v [4]}</td>
<td>{$str}</td>
</tr> ";
}
?>
</table>
</body>
Audit through code
<?php
$uid = $_get["UID"];
Include ("LZY.class.php");
$db = new LZY ();
$sql = "Update zhuce set isok=1 where uid= ' {$uid} '";
if ($db->query ($sql, 0))
{
Header ("location:zcmain.php");
}
Else
{
echo "Through failure! ";
}
Manipulating user registration, auditing, and login pages with PHP connection database