Php enables the administrator login function to open Dreamweaver cs6 and add the following code:
If ($ _ POST [user]) // determines whether to enter the user name
{
$ Name = $ _ POST ["user"]; // Obtain the logon username
$ Pass = $ _ POST ["pass"]; // Obtain the logon password
Require "ch16-1.php"; // reference the configuration file
$ Link = mysql_connect ($ db_host, $ db_user, $ db_pass) or die (mysql_error ());
Mysql_select_db ($ db_name, $ link );
$ SQL = "select * from $ table_user where u_name = '$ name' & u_pass =' $ pass '";
$ Result = mysql_query ($ SQL); // send an SQL request
If (@ mysql_num_rows ($ result )! = 0) // if a qualified user and password are found
{
Setcookie ("name", "$ name", time () + 60*60*24); // Create a COOKIE
Echo" ";
Echo" ";
Echo"";
Echo"
Login successful! Return to the background homepage in 1 second ...... ";
Echo"";
}
Else // if there is no qualified user and password
{
Echo"
Incorrect username or password! ";
}
}
?>
Administrator login