public function initSession ()
	{
		
		// Get session
		
		$session	= $this->getSessionData ();
		
		// Check session is valid
		
		if ($this->checkSession ($session) !== TRUE)
		{
			return $this->Logout ('invalid_session');
		}
		
		// Load user from session
		
		$this->fromSessionData ();
		
		// Read user

		if (!$this->Read ())
		{
			return $this->Logout ('user_read_error');
		}
		
		// Reset password
		
		$this->reset ('password');
		
		// If the user is not active or the active status has changed
		
		if ($session['active'] != $this->iget ('active') || !$this->iget ('active'))
		{
			return $this->Logout ('inactive');
		}
		
		// Check if the session has timed out
		
		if ($this->session ()->timedOut ($session['last_action']))
		{
			return $this->Logout ('timeout');
		}
		
		// Update action time
		
		$this->updateLastAction ();
		
		// Set login status
		
		$this->loggedIn	= TRUE;
		
		// Redirect to originally requested URL
		
		if ($this->session ()->get ('requested_url'))
		{
			$url = $this->session ()->get ('requested_url');
			$this->session ()->set ('requested_url', FALSE);
			new Redirect ($url);
		}
		
		// return TRUE
		
		return TRUE;
		
	}
public function initSession ()
	{
		
		// Get session
		
		$session	= $this->getSessionData ();
		
		// Check session is valid
		
		if ($this->checkSession ($session) !== TRUE)
		{
			return $this->Logout ('invalid_session');
		}
		
		// Load user from session
		
		$this->fromSessionData ();
		
		// Read user

		if (!$this->Read ())
		{
			return $this->Logout ('user_read_error');
		}
		
		// Reset password
		
		$this->reset ('password');
		
		// If the user is not active or the active status has changed
		
		if ($session['active'] != $this->iget ('active') || !$this->iget ('active'))
		{
			return $this->Logout ('inactive');
		}
		
		// Check if the session has timed out
		
		if ($this->session ()->timedOut ($session['last_action']))
		{
			return $this->Logout ('timeout');
		}
		
		// Update action time
		
		$this->updateLastAction ();
		
		// Set login status
		
		$this->loggedIn	= TRUE;
		
		// Redirect to originally requested URL
		
		if ($this->session ()->get ('requested_url'))
		{
			$url = $this->session ()->get ('requested_url');
			$this->session ()->set ('requested_url', FALSE);
			new Redirect ($url);
		}
		
		// return TRUE
		
		return TRUE;
		
	}
public function initSession ( ) { // Get session $ session = $ this -> getSessionData ( ) ; // Check session is valid if ( $ this -> checkSession ( $ session ) !== TRUE ) { return $ this -> Logout ( 'invalid_session' ) ; } // Load user from session $ this -> fromSessionData ( ) ; // Read user if ( ! $ this -> Read ( ) ) { return $ this -> Logout ( 'user_read_error' ) ; } // Reset password $ this -> reset ( 'password' ) ; // If the user is not active or the active status has changed if ( $ session [ 'active' ] != $ this -> iget ( 'active' ) || ! $ this -> iget ( 'active' ) ) { return $ this -> Logout ( 'inactive' ) ; } // Check if the session has timed out if ( $ this -> session ( ) -> timedOut ( $ session [ 'last_action' ] ) ) { return $ this -> Logout ( 'timeout' ) ; } // Update action time $ this -> updateLastAction ( ) ; // Set login status $ this -> loggedIn = TRUE ; // Redirect to originally requested URL if ( $ this -> session ( ) -> get ( 'requested_url' ) ) { $ url = $ this -> session ( ) -> get ( 'requested_url' ) ; $ this -> session ( ) -> set ( 'requested_url' , FALSE ) ; new Redirect ( $ url ) ; } // return TRUE return TRUE ; }
Initialise a user session and check it is valid
@return string|boolean Error
Initialise a user session and check it is valid