Example #1
0
 public static function start()
 {
     // Gets current time, next update, and expiration.
     // Note: i'm  making the last two digits to zero. for rounding purposes.
     self::$_NOW = BMK;
     self::$_TTU = (int) substr((string) self::$_NOW + self::$_TTU, 0, -2) . '00';
     self::$_EXP = (int) substr((string) self::$_NOW + self::$_EXP, 0, -2) . '00';
     // set the session id with the IP, User-agent and the fingerkey
     // TODO: Add username for login based frameworks
     session_id(self::$_ID = md5($_SERVER['SERVER_ADDR'] . $_SERVER['HTTP_USER_AGENT'] . Core::config('sess_finger')));
     // set the XML dom document, or create it if non existent.
     if (file_exists(SESS . 'session')) {
         XML::load(SESS . 'session');
     } else {
         XML::set(SESS . 'session');
     }
     // if we can't find the ID set, create it in the index..
     if (!($element = XML::get_id(self::$_ID))) {
         XML::append(array('tagname' => 'session', 'id' => self::$_ID, 'exp' => self::$_EXP));
     }
     // remove all expired sessions
     self::gc(0);
     // start session
     session_start();
 }