为什么我的会话变量没有正确传递?

时间:2013-06-27 19:39:49

标签: php variables single-sign-on session-variables

function User_CustomValidate(&$usr) {
    $appKey = "xxxxx";
    $safeurl =  'https://safe.xxxx.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['username'] = $_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;   

    }   

我正在创建一个SSO函数,它应该将SSO摘要数据传递给我的应用程序。我遇到了一个我无法弄清楚的变量问题。我的所有SESSION变量都在工作,我可以在所有页面上清楚地看到他们的结果。所以,当我回复$ _SESSION ['uid']时,我可以看到从我们的SSO传递的任何uid。但我从$ usr得到的一切都没有。我有声明$ usr = $ _SESSION ['uid']并且它什么都不返回。但是,当我将$ usr设置为'888888'时,它返回静态uid,一切正常。如何让会话uid通过?

0 个答案:

没有答案