Exemplo n.º 1
0
Arquivo: S.php Projeto: hfw/h
 /**
  * Initialize a new session for a user, such as for a login.
  * Registers a listener for the `error` event to reset the session to its initial state.
  */
 public static function start()
 {
     session_start();
     self::$reset = $_SESSION;
     E::listen('error', function () {
         self::reset();
     });
 }
Exemplo n.º 2
0
 public function get_backend($write = False)
 {
     if (!class_exists('\\HandlerSocket')) {
         throw new HSNotLoadedError();
     }
     $this->_load_config();
     $this->_check_config();
     if (static::$_default_connection) {
         return static::$_default_connection;
     }
     $conf = $this->_config['handlersocket'];
     $handlersocket = new \HandlerSocket($conf['host'], $conf['port']);
     $handlersocket_wr = new \HandlerSocket($conf['host'], $conf['port_wr']);
     $hs = HS::create()->set_handlersocket($handlersocket, $handlersocket_wr)->set_db($this->get_db_name());
     static::$_default_connection = $hs;
     return $hs;
 }