You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
mattbasta edited this page Sep 14, 2011
·
1 revision
Using the Session Manager
The session manager is completely automatic. A session is automatically created the first time a user accesses the site.
Sessions are composed of the following parameters, hashed together:
The user's IP address (to mitigate session hijacking)
A randomly generated value
A secret value kept in the constants file
Usage
In most contexts, a variable called $session is created. Setting any property of this object will store that data in the session. Accessing will retrieve the data from the session. If a property doesn't exist, it will return false.
if(!$session->shown) {
echo "Hello! This is the first request of your session.";
$session->shown = true;
}
To close a session, call the $session->destroy() method.
Settings
IXG_KV_SESSIONS
Setting this value to false will use the PHP session handler instead of the Interchange session handler. The $session variable will simply act as a $_SESSION wrapper. Using the Interchange session handler allows sessions to persist across multiple server instances that are serviced by a load balancer (by using a common key value store).
IXG_KV_SESSIONS_TIMEOUT
A timeout value to expire keys after. This should be set to the lifespan of a session.
Disable sessions
In a library, define the constant NOSESSION. Once this constant is defined, a session will not be instantiated. This can also be done from the constants file.