function SESession($storage = "none", $options = array()) { // Must close session connector, emulate destructor if (version_compare(PHP_VERSION, '5', '<')) { register_shutdown_function(array(&$this, '__destruct')); } // Destroy sessions started with session.auto_start if (session_id()) { session_unset(); session_destroy(); } // Force preferred ini settings ini_set('session.save_handler', 'files'); ini_set('session.use_trans_sid', '0'); // Create storage object $this->_store =& SESessionStorage::getInstance($storage, $options); // Set options $this->_setOptions($options); $this->_start(); // Init stat tracking and security $this->_setCounter(); $this->_setTimers(); $this->_state = 'active'; $this->_resume(); $this->_validate(); }
function SESessionStorageFile($options = array()) { if (isset($options['root'])) { $this->_save_path = realpath($options['root']); } if (!$this->test()) { die("Unable to initialize file-based session storage"); } parent::SESessionStorage($options); }
function SESessionStorageMemcache($options = array()) { if (!$this->test()) { die("The memcache extension isn't available"); } // Default server connection if (empty($options['servers'])) { $options['servers'] = array(array('host' => 'localhost', 'port' => '11211')); } parent::SESessionStorage($options); $this->_compress = isset($options['compress']) ? $options['compress'] : FALSE; $this->_persistent = isset($options['persistent']) ? $options['persistent'] : FALSE; $this->_servers = isset($options['servers']) ? $options['servers'] : array(); }