コード例 #1
0
 function testRefreshSession()
 {
     $this->generateSession();
     $this->outdateSession(SESSIONID);
     $this->dalSession->refreshSession(SESSIONID);
     $this->assertSessionData();
 }
コード例 #2
0
/**
 * Fetch sessiondata from the database
 *
 * This implementation uses the $_COOKIE superglobal to find session identifier.
 * @return void
 *
 * @todo Move to a domain-layer class library.
 */
function phpAds_SessionDataFetch()
{
    global $session;
    $dal = new MAX_Dal_Admin_Session();
    // Guard clause: Can't fetch a session without an ID
    if (empty($_COOKIE['sessionID'])) {
        return;
    }
    $serialized_session = $dal->getSerializedSession($_COOKIE['sessionID']);
    // This is required because 'sessionID' cookie is set to new during logout.
    // According to comments in the file it is because some servers do not
    // support setting cookies during redirect.
    if (empty($serialized_session)) {
        return;
    }
    $loaded_session = unserialize($serialized_session);
    if (!$loaded_session) {
        // XXX: Consider raising an error
        return;
    }
    $session = $loaded_session;
    $dal->refreshSession($_COOKIE['sessionID']);
}