PHP Class Session, huge

Inheritance: extends CI_Session
Afficher le fichier Open project: panique/huge Class Usage Examples

Méthodes publiques

Méthode Description
add ( mixed $key, mixed $value ) adds a value as a new array element to the key.
destroy ( ) deletes the session (= logs the user out)
get ( mixed $key ) : mixed gets/returns the value of a specific key of the session
init ( ) starts the session
isConcurrentSessionExists ( ) : boolean checks for session concurrency
set ( mixed $key, mixed $value ) sets a specific value to a specific key of the session
updateSessionId ( string $userId, string $sessionId = null ) : string update session id in database
userIsLoggedIn ( ) : boolean Checks if the user is logged in or not

Method Details

add() public static méthode

useful for collecting error messages etc
public static add ( mixed $key, mixed $value )
$key mixed
$value mixed

destroy() public static méthode

deletes the session (= logs the user out)
public static destroy ( )

get() public static méthode

gets/returns the value of a specific key of the session
public static get ( mixed $key ) : mixed
$key mixed Usually a string, right ?
Résultat mixed the key's value or nothing

init() public static méthode

starts the session
public static init ( )

isConcurrentSessionExists() public static méthode

This is done as the following: UserA logs in with his session id('123') and it will be stored in the database. Then, UserB logs in also using the same email and password of UserA from another PC, and also store the session id('456') in the database Now, Whenever UserA performs any action, You then check the session_id() against the last one stored in the database('456'), If they don't match then log both of them out.
See also: Session::updateSessionId()
See also: http://stackoverflow.com/questions/6126285/php-stop-concurrent-user-logins
public static isConcurrentSessionExists ( ) : boolean
Résultat boolean

set() public static méthode

sets a specific value to a specific key of the session
public static set ( mixed $key, mixed $value )
$key mixed key
$value mixed value

updateSessionId() public static méthode

update session id in database
public static updateSessionId ( string $userId, string $sessionId = null ) : string
$userId string
$sessionId string
Résultat string

userIsLoggedIn() public static méthode

Checks if the user is logged in or not
public static userIsLoggedIn ( ) : boolean
Résultat boolean user's login status