Ask the great God what's wrong with this code, why does the session variable not take effect?
if (!function_exists ("getsqlvaluestring")) {
function getsqlvaluestring ($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = GET_MAGIC_QUOTES_GPC ()? Stripslashes ($theValue): $theValue;
$theValue = function_exists ("mysql_real_escape_string")? Mysql_real_escape_string ($theValue): mysql_escape_string ($theValue);
Switch ($theType) {
Case "Text":
$theValue = ($theValue! = "")? "". $theValue. "'": "NULL";
Break
Case "Long":
Case "int":
$theValue = ($theValue! = "")? Intval ($theValue): "NULL";
Break
Case "Double":
$theValue = ($theValue! = "")? "". Doubleval ($theValue). "'": "NULL";
Break
Case "Date":
$theValue = ($theValue! = "")? "". $theValue. "'": "NULL";
Break
Case "defined":
$theValue = ($theValue! = "")? $theDefinedValue: $theNotDefinedValue;
Break
}
return $theValue;
}
}
mysql_select_db ($database _yiwuyiwu, $yiwuyiwu);
$query _recordset1 = "SELECT * from ' user '";
$Recordset 1 = mysql_query ($query _recordset1, $yiwuyiwu) or Die (Mysql_error ());
$row _recordset1 = Mysql_fetch_assoc ($Recordset 1);
$totalRows _recordset1 = mysql_num_rows ($Recordset 1);
?>
Validate request to login to this site.
if (!isset ($_session)) {
Session_Start ();
}
The session variable starts.
$loginFormAction = $_server[' php_self ');
if (Isset ($_get[' AccessCheck ')) {
$_session[' prevurl '] = $_get[' AccessCheck '];
}
if (Isset ($_post[' Username ')) {
$loginUsername =$_post[' Username '];
$password = (MD5 ($_post[' password '));
$MM _flduserauthorization = "Enable";
$MM _redirectloginsuccess = "index.php";
$MM _redirectloginfailed = "zhuce.php";
$MM _redirecttoreferrer = false;
Enter your account number and password to determine the steering page.
mysql_select_db ($database _yiwuyiwu, $yiwuyiwu);
$LoginRS __query=sprintf ("Select u_id U_name, pass, enable from ' user ' WHERE u_name=%s and pass=%s",
The Enable symbol is this "·"
Getsqlvaluestring ($loginUsername, "text"), getsqlvaluestring ($password, "text"));
$LoginRS = mysql_query ($LoginRS __query, $yiwuyiwu) or Die (Mysql_error ());
$row _loginrs = Mysql_fetch_assoc ($LoginRS);
$loginFoundUser = mysql_num_rows ($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = mysql_result ($LoginRS, 0, ' Enable ');
Declaring three session variables and assigning a value
$_session[' mm_username '] = $loginUsername;
$_session[' mm_usergroup '] = $loginStrGroup;
$_session[' u_id ']= $row _loginrs (' u_id ');
if (Isset ($_session[' Prevurl ')) && false) {
$MM _redirectloginsuccess = $_session[' Prevurl ');
}
Header ("Location:".) $MM _redirectloginsuccess);
}
else {
Header ("Location:".) $MM _redirectloginfailed);
}
}
?>
<title></title>
Login System