A login verification program based on MySQL (i.)

Source: Internet
Author: User
mysql| procedure.
/******************************************************
File name:login.php3
Login Check
Code: PHP 4
Author: Kevin Lee < webwing@21cn.com >

Database:mysql.
Host:localhost Database:mydb
Table structure for table ' user '
--------------------------------------------------------
CREATE TABLE User (
ID smallint (6) not NULL auto_increment,
User varchar (a) not NULL,
passwd varchar (a) not NULL,
Name varchar (20),
Email varchar (30),
Level char (1),
Status char (1),
UNIQUE ID (ID)
);
--------------------------------------------------------


*******************************************************/
?>
<script language= "JavaScript" >
function back () {
History.back ();
}
function Winclose () {
SetTimeout ("Self.close ()", 10000);
}
</script>
?
$db _id = mysql_pconnect ("localhost", "root", "");
$sql = "SELECT id, User, passwd from user where user= '". $name. "' and passwd= '". $pwd. "'";
$result = Mysql_db_query ("MyDB", $sql);
$row = Mysql_fetch_array ($result);
$id = $row [id];

if ($id!= "") {
Session_Start ();
Session_register ("yn");
$yn = "Yes";
echo "echo "You have successfully landed ... "." <p> ";
echo "<center>". The window automatically closes after 10 seconds. </center> ";
echo "</body>
}
else {
echo "Account or password error!!! ";
echo "<P>";
echo "<center>";
echo "<a href=\" #\ "onclick=\" javascript:back () \ ">back</a>";
echo "</center>";
}
?>

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.