Full code for PHP landing page

Source: Internet
Author: User

/*

Included files

*/

/*

login.php

*/

<?php
Require ('./mysql.php ');
$username =$_request[' username '];
$passwd =$_request[' passwd ']
Session_Start ();
$_session[' S_username ']= $username;
$query _user= "SELECT * from user where username = ' $username ' and passwd = ' $passwd '";
$db =new MySQL ();//Instantiate class MySQL
$result = $db->query_exec ($query _user);//Verify User
$num _results= $result->num_rows;//get the record rows in the database

if ($num _results==0)
{
Echo ' Login fail!! ';
?>
<p><a href= "./template/login.htm" > Back to login </a></p>
<?php
}else{
Header ("Location:./index.php");
}
?>

/*

Templates/login.tpl

*/

<meta http-equiv= "text/html;charset= ' Utf-8 '" >
<link rel= "stylesheet" type= "Text/css" href= "./css/login.css" >
<script type= "Text/javascript" src= "Js/face.js" ></script>
<body>
<table width= "400px" height= "208" border= "0" cellpadding= "0" cellspacing= "0" >
<form id= "Login" name= "login" method= "POST" action= "a.php" onsubmit= "" >
<tr>
&LT;TD height= "align=" "right" > User name:</td>
<td><input name= "name" type= "text" onmouseover= "this.style.backgroundcolor= ' #ffffff '" onmouseout= " This.style.backgroundcolor= ' #e8f4ff ' "size="/></td>
</tr>
<tr>
&LT;TD height= "align=" "right" > Password:</td>
<td><input name= "password" type= "password" id= "password" onmouseover= "this.style.backgroundcolor=" #ffffff ' "onmouseout=" this.style.backgroundcolor= ' #e8f4ff ' "size="/></td>
</tr>
<tr>
&LT;TD height= "" "align=" right "> Verification Code:</td>
<td><input name= "Check" type= "text" id= "check" onmouseover= "this.style.backgroundcolor= ' #ffffff '" onmouseout= "this.style.backgroundcolor= ' #e8f4ff '" size= "/></td>
</tr>

/*

mysql.php

*/

<?php
var $db _host = ' localhost ';
var $db _username= ' root ';
var $db _password= ' 123 ';
var $db _database= ' new ';


$db =mysql_connect ($ db_host, $db _username,$-> db_password,$-> db_database);
if (Mysqli_connect_errno ()) {
echo "Connection database failed!";
Exit
}
return $db;
}

}
?>

/*

Effect is */

Category: PHP

Full code for PHP landing page

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.