ePages 6.17.12 - DE_EPAGES/Presentation/API/Session.pm

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.

Additional session attributes can be created with the function SetSessionAttribute.

@EXPORT_OK
GenerateSessionID
InsertSession
ExistsSessionAttribute
GetSessionAttribute
SetSessionAttribute
GetSessionAttributes
IsSessionTimedOut
GetSessionAge
TestAdminSFSession
CreateAdminSFSessionID
GetAdminSFSessionCookie

Functions

CreateAdminSFSessionID
ExistsSessionAttribute
GenerateSessionID
GetAdminSFSessionCookie
GetSessionAge
GetSessionAttribute
GetSessionAttributes
InsertSession
IsSessionTimedOut
SetSessionAttribute
TestAdminSFSession

CreateAdminSFSessionID

Returns an admin session id for the usage in the closed storefront or undef is session is invalid

Syntax
$AdminSFSessionID = CreateAdminSFSessionID($Site,$SessionID)
Input
$Site (object)
site object
$SessionID (string)
session of user
Return
$AdminSFSessionID (string)
des crypted admin session id or undef

ExistsSessionAttribute

Returns true if a session attribute exists.

Syntax
$Exists = ExistsSessionAttribute($Name);
Input
$Name (string)
name of session attribute
Return
$Exists (boolean)
exists attribute

GenerateSessionID

Generates a new, unique session id. The session id is not automatically registered in the database. See also InsertSession.

Syntax
$SessionID = GenerateSessionID()
$SessionID = GenerateSessionID( $Address, $Port )
Example
$SessionID = GenerateSessionID( '12.34.56.78', 10047 )
Input
$Address (string)
(optional) application server IP address or '0.0.0.0'
$Port (int)
(optional) application server port
Return
$SessionID (string)
a new session id

GetAdminSFSessionCookie

Gets the cookie value for cookie MerchantSF from the current request

Syntax
$AdminSessionCookie = GetAdminSFSessionCookie()
Return
$AdminSessionCookie (string)
cookie value

GetSessionAge

Get the number of minutes since creation of the session.

Syntax
GetSessionAge($IntSessionID);
Input
$IntSessionID (int)
internal session id
Return
$minutes (integer)
age of the session in minutes

GetSessionAttribute

Returns a session attribute value.

Syntax
$Value = GetSessionAttribute( $IntSessionID, $Name )
Input
$IntSessionID (int)
internal session id
$Name (string)
name of session attribute
Return
$Value (string)
session parameter

GetSessionAttributes

Returns all session attribute values.

Syntax
$aValues = GetSessionAttributes()
Return
$aValues (reference to array)
session attributes values

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
$User (object)
user (optional)
$PerCookie (bit)
user identified by cookie (optional)
Return
$SessionID (string)
a new session id

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)
Example
if (IsSessionTimedOut($IntSessionID)) { ... }
Input
$IntSessionID (int)
internal session id
Return
$IsTimeout (boolean)
true if the session has timed out

SetSessionAttribute

Sets a session attribute value.

Syntax
SetSessionAttribute( $IntSessionID, $Name, $Value )
Input
$IntSessionID (int)
internal session id
$Name (string)
name of session attribute
$Value (string)
session parameter

TestAdminSFSession

Check if a valid admin session exists for usage in the closed storefront.

Syntax
$ExistsValidAdminSession = TestAdminSFSession($Site,$Cookie)
Example
if (TestAdminSFSession($Site,$Cookie) == -1) { ... }
Input
$Site (object)
shop object
$Cookie (string)
cookie value
Return
$ExistsValidAdminSession (integer)
1 if admin session for sf exists and all is valid,
0 if is not a admin sf session (not ClosedByMerchant ),
-1 if session is invalid (ClosedByMerchant and e.g. no cookie)