Package DE_EPAGES::Presentation::API::Session
This package provides the interface for sessions, session ids and session attributes. The TLE variable #Session implemented by DE_EPAGES::Presentation::API::TLE::SessionHandler provides access to session attributes from the TLE language. Note that #Session is undefined if the user is not logged on and does not have a basket yet. The following list shows all pre-defined session attributes.
- User - user identified by the session (class:User, can be undefind) - object
- UserID - id of the user identified by the session (can be undefind) - integer
- IsClosed - true if the session is no longer valid, either because the user has signed our or because the session has timed out - boolean
- IsCookieIdentified - true if the session was associated with the user based on a cookie. For security reasons it may be necessary to request confirmation of the users identity by asking for the password - integer
- CreationDate - date and time when the session has started - datetime
- RemoteIP - IP address of the client - string
- RemoteHost - host name or IP address of the client (can be undefined) - string
- RemoteUser - user name if the user was identified via HTTP authentication (can be undefind) - string
- RefererURL - URL of the previously visited page before the session has started - string
@EXPORT_OK |
Functions
- ExistsSessionAttribute
- GenerateSessionID
- GetSessionAge
- GetSessionAttribute
- GetSessionAttributes
- InsertSession
- IsSessionTimedOut
- SetSessionAttribute
ExistsSessionAttribute
Returns true if a session attribute exists.
Syntax |
$Exists = ExistsSessionAttribute($Name); |
Input |
|
Return |
|
GenerateSessionID
Generates a new, unique session id. The session id is not automatically registered in the database. See also InsertSession.
Syntax |
$SessionID = GenerateSessionID( $Address, $Port ) |
Example |
$SessionID = GenerateSessionID( '12.34.56.78', 10047 ) |
Input |
|
Return |
|
GetSessionAge
Get the number of minutes since creation of the session.
Syntax |
GetSessionAge($IntSessionID); |
Input |
|
Return |
|
GetSessionAttribute
Returns a session attribute value.
Syntax |
$Value = GetSessionAttribute( $IntSessionID, $Name ) |
Input |
|
Output |
|
GetSessionAttributes
Returns all session attribute values.
Syntax |
$aValues = GetSessionAttributes() |
Output |
|
InsertSession
Generates a new session id for a user and saves it in the database. If you have access to a servlet object, use $Servlet->registerSession($User, $PerCookie) instead of InsertSession(). See: DE_EPAGES::Presentation::Servlet::Permission::registerSession
Syntax |
$SessionID = InsertSession($User, $PerCookie); |
Input |
|
Return |
|
IsSessionTimedOut
Check if a session has timed out, that is, at least as many minutes as the session timeout have gone since session creation.
Syntax |
$IsTimeout = IsSessionTimedOut($IntSessionID) if (IsSessionTimedOut($IntSessionID)) { ... } |
Input |
|
Return |
|
SetSessionAttribute
Sets a session attribute value.
Syntax |
SetSessionAttribute( $IntSessionID, $Name, $Value ) |
Input |
|