[英]Why isn't $_SESSION data being passed to all parts of my function file?
我正在重做许多登录脚本,并使用这样的大型功能文件在我们的一个内部站点上运行。
我运行的脚本检索SSO $_SESSION
数据,并希望将其从SSO服务器传递到用户会话。
我尝试在文件的不同部分运行脚本,但得到相同的结果。 它在某些地方有效,而在其他地方则无效。
我可以将所有$_SESSION
变量回显到HTML页面。
我还可以在某些类中使用$_SESSION
数据(无论放在哪里,都一样)。
但是,我确实需要使用该类-验证用户-所有内容都为null。
我在这里缺少什么吗(请不要告诉我将session_start();
放入)。
我认为$_SESSION
数据是超全局的。 也是检索$_SESSION
数据超全局的吗?
如果不是,我需要怎么做才能使其具有超全球性?
这是我用来检索会话数据以继续传递的脚本-
session_start();
$appKey = "00000000Uz";
$safeurl = 'https://safe.000000.com/login/sso/SSOService?app=playbooks';
// first call back after safe login - POST is set
if ($_POST && isset($_POST['digest']))
{
$digest = $_POST["digest"];
// set the session variables ...
$_SESSION['usernames'] = $_POST["firstname"]." ".$_POST["lastname"];
$_SESSION['firstname'] = $_POST["firstname"];
$_SESSION['lastname'] = $_POST["lastname"];
$_SESSION['email'] = $_POST["email"];
$_SESSION['uid'] = $_POST["uid"];
// Needed for key
$uid = $_POST["uid"];
$time = $_POST["time"];
// Read the property file with the key and URL so this won't go into the main code
// this sets $appKey and $safeurl
$mykey = "".$uid.$time.$appKey;
$mydigest = md5($mykey);
}
// session is not initialized as we never got the post above to set session vars
// call now the safe login to get the post to set the session vars ...
if (!isset($_SESSION['uid']) || empty($_SESSION['uid']))
{
// Read the property file with the key and URL so this won't go into the main code
// this sets $appKey and $safeurl
header("Location: ".$safeurl);
}
$usr = $_SESSION['uid'];
$this->setCurrentUserName($usr);
return TRUE;
}
使用$_SESSION
之前,请确保您正在调用session_start()
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.