public static function getFromRequest($create = true)
    {
        $sessionData = [
            'LastIP' => inet_pton($_SERVER['REMOTE_ADDR']),
            'LastRequest' => time(),
        ];

        // try to load from cookie
        if (!empty($_COOKIE[static::$cookieName])) {
            if ($Session = static::getByHandle($_COOKIE[static::$cookieName])) {
                // update session & check expiration
                $Session = static::updateSession($Session, $sessionData);
            }
        }

        // try to load from any request method
        if (empty($Session) && !empty($_REQUEST[static::$cookieName])) {
            if ($Session = static::getByHandle($_REQUEST[static::$cookieName])) {
                // update session & check expiration
                $Session = static::updateSession($Session, $sessionData);
            }
        }

        if (!empty($Session)) {
            // session found
            return $Session;
        } elseif ($create) {
            // create session
            return static::create($sessionData, true);
        } else {
            // no session available
            return false;
        }
    }
public static function getFromRequest($create = true)
    {
        $sessionData = [
            'LastIP' => inet_pton($_SERVER['REMOTE_ADDR']),
            'LastRequest' => time(),
        ];

        // try to load from cookie
        if (!empty($_COOKIE[static::$cookieName])) {
            if ($Session = static::getByHandle($_COOKIE[static::$cookieName])) {
                // update session & check expiration
                $Session = static::updateSession($Session, $sessionData);
            }
        }

        // try to load from any request method
        if (empty($Session) && !empty($_REQUEST[static::$cookieName])) {
            if ($Session = static::getByHandle($_REQUEST[static::$cookieName])) {
                // update session & check expiration
                $Session = static::updateSession($Session, $sessionData);
            }
        }

        if (!empty($Session)) {
            // session found
            return $Session;
        } elseif ($create) {
            // create session
            return static::create($sessionData, true);
        } else {
            // no session available
            return false;
        }
    }
public static function getFromRequest ( $ create = true ) { $ sessionData = [ 'LastIP' => inet_pton ( $ _SERVER [ 'REMOTE_ADDR' ] ) , 'LastRequest' => time ( ) , ] ; // try to load from cookie if ( ! empty ( $ _COOKIE [ static :: $ cookieName ] ) ) { if ( $ Session = static :: getByHandle ( $ _COOKIE [ static :: $ cookieName ] ) ) { // update session & check expiration $ Session = static :: updateSession ( $ Session , $ sessionData ) ; } } // try to load from any request method if ( empty ( $ Session ) && ! empty ( $ _REQUEST [ static :: $ cookieName ] ) ) { if ( $ Session = static :: getByHandle ( $ _REQUEST [ static :: $ cookieName ] ) ) { // update session & check expiration $ Session = static :: updateSession ( $ Session , $ sessionData ) ; } } if ( ! empty ( $ Session ) ) { // session found return $ Session ; } elseif ( $ create ) { // create session return static :: create ( $ sessionData , true ) ; } else { // no session available return false ; } }
Gets or sets up a session based on current cookies.
Will always update the current session's LastIP and LastRequest fields.

@param boolean $create
@return static|false
Gets or sets up a session based on current cookies . Will always update the current session s LastIP and LastRequest fields .