예제 #1
0
 /**
  * Create a new session
  *
  * @access	public
  * @return	void
  */
 function sess_create()
 {
     $sessid = '';
     while (strlen($sessid) < 32) {
         $sessid .= mt_rand(0, mt_getrandmax());
     }
     // To make the session ID even more secure we'll combine it with the user's IP
     $sessid .= $this->CI->input->ip_address();
     $this->userdata = array('session_id' => md5(uniqid($sessid, TRUE)), 'ip_address' => $this->CI->input->ip_address(), 'user_agent' => substr($this->CI->input->user_agent(), 0, 120), 'last_activity' => $this->now, 'user_data' => '');
     // Save the data to the DB if needed
     if ($this->sess_use_database === TRUE) {
         // $this->CI->db->query($this->CI->db->insert_string($this->sess_table_name, $this->userdata));
         SessionData::create($this->userdata);
     }
     // Write the cookie
     $this->_set_cookie();
 }