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.

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


var name – session name.


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

var id – session ID.


// 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 () – Стартует сессию.


// start the session

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


// delete the session when the user click "Exit"

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


// 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

By default, session cookies are stored for two weeks.