Use PHP connection database to operate user registration, audit and login page

Source: Internet
Author: User

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

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.