class Session

Supports functions for user sessions. This class never gets instantiated.

Constants

INFO

info alert

SUCCESS

success alert

WARNING

warning alert

DANGER

danger alert

PRIMARY

primary alert

SECONDARY

secondary alert

DARK

dark alert

LIGHT

light alert

Methods

static void
addMessage(string $type, string $message)

Adds a session alert message.

static void
delete(string $name)

Removes CURRENT_USER_SESSION_NAME from the $_SESSION superglobal array when a user logs out of a user session.

static string
displayMessage()

Displays messages related to actions a user may perform.

static bool
exists(string $name)

Checks if a session by user name exists.

static mixed
get(string $name)

Getter function that returns the $_SESSION superglobal associative array.

static mixed
set(string $name, mixed $value)

Sets a value in the $_SESSION superglobal array.

static string
uagent_no_version()

Don't store browser version numbers so we don't break session during end user software updates.

Details

at line 38
static void addMessage(string $type, string $message)

Adds a session alert message.

Parameters

string $type

Can be info, success, warning, danger, primary, secondary, light, or dark.

string $message

The message you want to display in the alert.

Return Value

void

at line 59
static void delete(string $name)

Removes CURRENT_USER_SESSION_NAME from the $_SESSION superglobal array when a user logs out of a user session.

Parameters

string $name

The CURRENT_USER_SESSION_NAME associated with the current user session.

Return Value

void

at line 71
static string displayMessage()

Displays messages related to actions a user may perform.

Return Value

string

A HTML element containing a message along with a button button to dismiss the message.

at line 93
static bool exists(string $name)

Checks if a session by user name exists.

Parameters

string $name

The id of the user associated with a particular session.

Return Value

bool

True if the session exists. Otherwise we return false.

at line 106
static mixed get(string $name)

Getter function that returns the $_SESSION superglobal associative array.

Parameters

string $name

The user_id of the user associated with a particular session.

Return Value

mixed

Element in the $_SESSION superglobal array for CURRENT_USER_SESSION_NAME set as id for current logged in user.

at line 117
static mixed set(string $name, mixed $value)

Sets a value in the $_SESSION superglobal array.

Parameters

string $name

The session key name.

mixed $value

The value to store in the session (can be string, int, array, object, etc).

Return Value

mixed

The value that was set in the session.

at line 127
static string uagent_no_version()

Don't store browser version numbers so we don't break session during end user software updates.

Return Value

string

User agent information with the browser version removed.