Ask the great God to tell me what's wrong with the code. Why the session variable does not take effect

Source: Internet
Author: User
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







  • user login

    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.