/** * We set the session environment variables and * define a custom session handler **/ public static function _construct() { // get values from config // We convert minutes to seconds in session update and expire. if (!(self::$_TTU = round((double) Core::config('sess_update') * 60))) { self::_error('VARINT', 'sess_update'); } if (!(self::$_EXP = round((double) Core::config('sess_expire') * 60))) { self::_error('VARINT', 'sess_expire'); } if (!in_array(strtoupper(self::$_MTD = Core::config('sess_method')), self::$_AM)) { self::_error('VAR404', 'sess_method["' . self::$_MTD . '"]'); } if (!is_bool(self::$_CYP = Core::config('sess_encrypt'))) { self::_error('VARFOR', 'sess_encrypt'); } self::$_NAM = Core::config('sess_name'); // set the functions for handling sessions $s = 'Session'; session_set_save_handler(array($s, 'open'), array($s, 'close'), array($s, 'read'), array($s, 'write'), array($s, 'destroy'), array($s, 'gc')); // register this function at the end of execution so the sessions write everytime register_shutdown_function('session_write_close'); }