PHP Класс Session, huge

Наследование: extends CI_Session
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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

Описание методов

add() публичный статический Метод

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

destroy() публичный статический Метод

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

get() публичный статический Метод

gets/returns the value of a specific key of the session
public static get ( mixed $key ) : mixed
$key mixed Usually a string, right ?
Результат mixed the key's value or nothing

init() публичный статический Метод

starts the session
public static init ( )

isConcurrentSessionExists() публичный статический Метод

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.
См. также: Session::updateSessionId()
См. также: http://stackoverflow.com/questions/6126285/php-stop-concurrent-user-logins
public static isConcurrentSessionExists ( ) : boolean
Результат boolean

set() публичный статический Метод

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() публичный статический Метод

update session id in database
public static updateSessionId ( string $userId, string $sessionId = null ) : string
$userId string
$sessionId string
Результат string

userIsLoggedIn() публичный статический Метод

Checks if the user is logged in or not
public static userIsLoggedIn ( ) : boolean
Результат boolean user's login status