[ERROR#1] Sessions — Documentation — DIAFAN.CMS

Sessions

For work with sessions define class Session in the file includes/session.php. The class object is created at the initiation site and is accessible via the variable $this->diafan->_session.

Attention!
The methods of this class are systemic. Their change may cause unstable operation of the entire system.

Свойства

var name – session name.

Example:

echo 'Session name: '.$this->diafan->_session->name;
// output:
// Session name: SESS629188aff6a3c660dc46dedf8724eb61

var id – session ID.

Example:

// use the session as an identifier for the search
// activated online contests for the current user
$coupon_id = DB::query_result("SELECT coupon_id FROM {shop_discount_person}"
." WHERE session_id='%s'", $this->diafan->_session->id);

Методы

void init () – Стартует сессию.

Example:

// start the session
$this->diafan->_session->init();

Functions open, close, read, write, dc, destroy are user session storage functions. They are connected via a PHP-function session_set_save_handler.

boolean true open () – Открывает сессию.

boolean true close () – Закрывает сессию освобождает ресурсы.

string read (string $key) – Читает сессию.

  • string $key: session ID

return true write (string $key, string $value) – Записывает данные в сессию.

  • string $key: session ID
  • string $value: серилизованные данные сессии

void gc () – Чистит мусор - удаляет сессии старше $lifetime.

void destroy ([string $key = '']) – Удаляет ссессию.

  • string $key: session ID

Example:

// delete the session when the user click "Exit"
$this->diafan->_session->destroy();

void duration () – Определяет продолжительность сессии.

Example:

// if the authorization is checked "Do not remember me,"
// the duration of the session, lives up to the closing of the browser window
// Otherwise the session duration is set for a period of 2 weeks
$this->diafan->_session->duration();

By default, session cookies are stored for two weeks.

Methods with the same name as their class will not be constructors in a future version of PHP; Markdown_Parser has a deprecated constructor
#1 include_once() called at [/var/www/diafan/data/www/diafancms.com/modules/docs/docs.model.php:499]
#2 Docs_model->prepare_text( For work with sessions define class *Session* in the file *includes/session.php*. The class object is created at the initiation site and is accessible via the variable `$this->diafan->_session...) called at [/var/www/diafan/data/www/diafancms.com/modules/docs/docs.model.php:94]
#3 Docs_model->show() called at [/var/www/diafan/data/www/diafancms.com/modules/docs/docs.php:29]
#4 Docs->init() called at [/var/www/diafan/data/www/diafancms.com/includes/init.php:474]
#5 Init->module() called at [/var/www/diafan/data/www/diafancms.com/includes/init.php:119]
#6 Init->start() called at [/var/www/diafan/data/www/diafancms.com/index.php:62]
/var/www/diafan/data/www/diafancms.com/modules/docs/docs.model.php:499