__construct() public method

Class constructor
public __construct ( array $params = [] ) : void
$params array Configuration parameters
return void
Example #1
0
 public function __construct($params = array())
 {
     if (session_id() == '') {
         @session_start();
     }
     parent::__construct($params);
 }
Example #2
0
 public function __construct()
 {
     parent::__construct();
     $CI =& get_instance();
     $CI->load->helper('url');
     $CI->load->library('session');
     $CI->load->database();
 }
Example #3
0
 public function __construct(array $params = array())
 {
     if (ENVIRONMENT === 'testing') {
         log_message('debug', 'Session: Initialization under testing aborted.');
         return;
     }
     parent::__construct($params);
 }
 function __construct()
 {
     parent::__construct();
     $CI =& get_instance();
     $this->_model = $CI;
     $this->_model->load->database();
     $this->_model->load->model("muser");
 }
	function __construct($param = array())
	{
		parent::__construct();
		$this->CI =& get_instance();
		$this->_setinstance($param, 'cookie');
		$this->_setinstance($param, 'secure');
		$this->_setinstance($param, 'regenerate');
		$this->_session();
	}
 public function __construct()
 {
     $CI = get_instance();
     //Extend the session class so that it doesnt create a session cookie and row in db if the request comes from commandline
     if ($CI->input->is_cli_request()) {
         return;
     }
     parent::__construct();
 }
 public function __construct($rules = array())
 {
     log_message('debug', '*** Hello from MY_Session ***');
     $this->CI =& get_instance();
     $this->CI->load->config('cimongo');
     $this->sess_use_mongo = $this->CI->config->item('sess_use_mongo');
     $this->sess_collection_name = $this->CI->config->item('sess_collection_name');
     $this->CI->load->library("cimongo/cimongo");
     parent::__construct();
 }
Example #8
0
 function __construct()
 {
     // Don't load session constructor if this is a FLASH Request.
     if (!IS_FLASH) {
         $this->CI =& get_instance();
         // If we are using the database build it (or at least make sure it is built).
         if ($this->CI->config->item('sess_use_database')) {
             $this->_build_db();
         }
         // Call parent constructor last.
         parent::__construct();
     }
 }
Example #9
0
 public function __construct()
 {
     $CI =& get_instance();
     $CI->load->helper("filebin");
     /* Clients using API keys do not need a persistent session since API keys
      * should be sent with each request. This reduces database queries and
      * prevents us from sending useless cookies.
      */
     if (!stateful_client()) {
         $this->memory_only = true;
         $CI->config->set_item("sess_use_database", false);
     }
     parent::__construct();
 }
Example #10
0
 function __construct($params = array())
 {
     $this->CI =& get_instance();
     $this->driver = strtolower($this->CI->config->item('sess_driver'));
     if ($this->driver == 'database') {
         $this->CI->config->set_item('sess_use_database', true);
     }
     if ($this->driver == 'database' || $this->driver == 'cookie' || $this->driver == '') {
         $this->is_custom_session = false;
         parent::__construct($params);
     } else {
         $this->CI->load->library('session/' . $this->driver, $params, 'session_driver');
         $this->session_driver =& $this->CI->session_driver;
         // Delete 'old' flashdata (from last request)
         $this->_flashdata_sweep();
         // Mark all new flashdata as old (data will be deleted before next request)
         $this->_flashdata_mark();
     }
 }
Example #11
0
 function __construct()
 {
     parent::__construct();
     $this->CI->session = $this;
 }
Example #12
0
 function __construct($params = array())
 {
     parent::__construct($params);
 }
Example #13
0
 function __construct()
 {
     parent::__construct();
     $this->tracker();
 }
Example #14
0
 public function __construct(array $params = array())
 {
     parent::__construct($params);
     $CI =& get_instance();
     $CI->load->helper('url');
 }
 function __construct()
 {
     parent::__construct();
 }
 function __construct()
 {
     parent::__construct();
     $this->CI->load->helper('url');
     $this->tracker();
 }
 public function __construct()
 {
     parent::__construct();
     //flash seems to use this user agent, so we can identify if the request is coming from uploadify
     if ($this->userdata('user_agent') == "Shockwave Flash") {
         //a custom session variable, if your already "logged in" on your flash session, than just make sure the session is still valid.
         if ($this->userdata('logged_in')) {
             //make sure parent is still active
             if (!$this->userdata('parent_session')) {
                 $this->sess_destroy();
                 return;
             }
             $this->CI->db->where('session_id', $this->userdata('parent_session'));
             $this->CI->db->where('ip_address', $this->userdata('ip_address'));
             $this->CI->db->select("last_activity");
             $query = $this->CI->db->get($this->sess_table_name);
             // couldnt find session
             if ($query->num_rows() == 0) {
                 $this->sess_destroy();
                 return;
             }
             $row = $query->row();
             $last_activity = $row->last_activity;
             //check that the session hasnt expired
             if ($last_activity + $this->sess_expiration < $this->now) {
                 $this->sess_destroy();
                 return;
             }
             //not yet logged in
         } else {
             $sessdata = $this->CI->input->post('sessdata');
             if ($sessdata) {
                 //decode the sess data
                 $sessdata = $this->CI->encrypt->decode($sessdata);
                 $sessdata = unserialize($sessdata);
                 if (empty($sessdata['session_id']) || empty($sessdata['timestamp'])) {
                     $this->sess_destroy();
                     return;
                 }
                 //attempt to clone the session...
                 $parent_session['session_id'] = $sessdata['session_id'];
                 $parent_session['ip_address'] = $this->userdata('ip_address');
                 $this->CI->db->where('session_id', $parent_session['session_id']);
                 $this->CI->db->where('ip_address', $parent_session['ip_address']);
                 $query = $this->CI->db->get($this->sess_table_name);
                 // couldnt find session
                 if ($query->num_rows() == 0) {
                     $this->sess_destroy();
                     return;
                 }
                 //retreive data
                 $row = $query->row();
                 $parent_session['last_activity'] = $row->last_activity;
                 if (isset($row->user_data) and $row->user_data != '') {
                     $custom_data = $this->_unserialize($row->user_data);
                     if (is_array($custom_data)) {
                         foreach ($custom_data as $key => $val) {
                             $parent_session[$key] = $val;
                         }
                     }
                 }
                 //check that the session hasnt expired
                 if ($parent_session['last_activity'] + $this->sess_expiration < $this->now) {
                     $this->sess_destroy();
                     return;
                 }
                 if ($parent_session['logged_in']) {
                     //DO STUFF HERE
                     //You want to mimic the values of the parent session. But for better security flash will still maintain its own session id. if you use a logged_in flag and user_id in your session vars to check if a user is signed on and identify them, you'll want to set that up here.
                     $this->set_userdata('parent_session', $parent_session['session_id']);
                     $this->set_userdata('logged_in', $parent_session['logged_in']);
                     $this->set_userdata('user_id', $parent_session['user_id']);
                 }
             } else {
                 $this->sess_destroy();
                 return;
             }
         }
     }
 }
 /**
  * Class constructor
  *
  * Loads some of the common libraries, helpers and models used on the class.
  *
  * @access	public
  * @param	array	Session parameters
  * @return	none
  */
 function __construct($params = array())
 {
     parent::__construct($params);
     $CI =& get_instance();
     $this->db = $CI->load->database('default', TRUE);
 }
 /**
  * Session Constructor
  *
  * The constructor runs the session routines automatically
  * whenever the class is instantiated.
  */
 public function __construct($params = array())
 {
     $this->CI =& get_instance();
     $this->CI->load->library('mongo_db');
     parent::__construct();
 }
Example #20
0
 function __construct()
 {
     parent::__construct();
     $this->now = time();
 }
 public function __construct(array $params = [])
 {
     parent::__construct($params);
 }
Example #22
0
 public function __construct()
 {
     parent::__construct();
     $this->is_logged_in();
 }
Example #23
0
 function __construct()
 {
     parent::__construct();
     $this->tracker();
     $this->CI->load->library('nativesession');
 }