Copy CodeThe code is as follows:
$hostname _conn = "localhost";
$database _conn = "Test";
$username _conn = "root";
$password _conn = "1981427";
$conn = mysql_connect ($hostname _conn, $username _conn, $password _conn);
?>
Copy the Code code as follows:
This function is used to convert a generic string into the format required by the SQL statement
function getsqlvaluestring ($theValue, $theType)
{
$theValue = (!GET_MAGIC_QUOTES_GPC ())? Addslashes ($theValue): $theValue;
Switch ($theType) {
Case "Text":
$theValue = ($theValue! = "")? "". $theValue. "'": "NULL";
Break
Case "int":
$theValue = ($theValue! = "")? Intval ($theValue): "NULL";
Break
}
return $theValue;
}
?>
Copy the Code code as follows:
Session_Start ();
If the session does not exist, jump to admin.php
if (! ( Isset ($_session[' mm_username '))) {
Header ("Location:admin.php");
Exit
}
?>
Copy the Code code as follows:
Validate request to login to this site.
Session_Start ();
$loginFormAction = $_server[' php_self ');
if (Isset ($accesscheck)) {
$GLOBALS [' prevurl '] = $accesscheck;
Session_register (' Prevurl ');
}
if (isset ($_post[' username ')) {
$loginUsername =$_post[' username '];
$password =$_post[' password '];
$MM _flduserauthorization = "";
$MM _redirectloginsuccess = "adminmain.php";
$MM _redirectloginfailed = "admin.php";
$MM _redirecttoreferrer = false;
mysql_select_db ($database _conn, $conn);
$LoginRS __query=sprintf ("Select AdminName, password from admin WHERE adminname= '%s ' and password= '%s '",
GET_MAGIC_QUOTES_GPC ()? $loginUsername: Addslashes ($loginUsername), GET_MAGIC_QUOTES_GPC ()? $password: Addslashes ($password));
$LoginRS = mysql_query ($LoginRS __query, $conn) or Die (Mysql_error ());
$loginFoundUser = mysql_num_rows ($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = "";
Declare session variables and assign them
$GLOBALS [' mm_username '] = $loginUsername;
$GLOBALS [' mm_usergroup '] = $loginStrGroup;
Register the session variables
Session_register ("Mm_username");
Session_register ("Mm_usergroup");
if (Isset ($_session[' Prevurl ')) && false) {
$MM _redirectloginsuccess = $_session[' Prevurl ');
}
Header ("Location:".) $MM _redirectloginsuccess);
}
else {
Header ("Location:".) $MM _redirectloginfailed);
}
}
?>
<title>Untitled Document</title>
. style1 {font-size:18px;
Font-weight:bold;
}
. style2 {FONT-SIZE:14PX}
Message board-Manage Login
View Message | Post a message
Current 1/2 Page 12 next page
The above describes the Apache php mysql PHP mysql message This application example 1th/2 page, including the Apache PHP MySQL content, I hope the PHP tutorial interested in a friend helpful.