求大神给指点下这些代码有什么有关问题啊为什么session变量不生效
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了求大神给指点下这些代码有什么有关问题啊为什么session变量不生效,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2777字,纯文字阅读大概需要4分钟。
内容图文
![求大神给指点下这些代码有什么有关问题啊为什么session变量不生效](/upload/InfoBanner/zyjiaocheng/230/2aa62c04eedc4f61ac3fb69ccc734b63.jpg)
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`";
$Recordset1 = mysql_query($query_Recordset1, $yiwuyiwu) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
session_start();
}
// ***session变量开始了
$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;
//*** 输入账号和密码,判断转向页面。
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",
//*** 启用符号是这个“·”
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');
//*** 声明三个会话变量并分配值
$_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 );
}
}
?>
登录系统
内容总结
以上是互联网集市为您收集整理的求大神给指点下这些代码有什么有关问题啊为什么session变量不生效全部内容,希望文章能够帮你解决求大神给指点下这些代码有什么有关问题啊为什么session变量不生效所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。