Fix bug that prevents a clean logout
This commit is contained in:
@@ -64,8 +64,10 @@ class MY_Session extends CI_Session {
|
|||||||
|
|
||||||
// before continuing, we need to determine if there is any custom data to deal with.
|
// before continuing, we need to determine if there is any custom data to deal with.
|
||||||
foreach (array('session_id', 'user_id', 'ip_address', 'user_agent', 'last_activity') as $val) {
|
foreach (array('session_id', 'user_id', 'ip_address', 'user_agent', 'last_activity') as $val) {
|
||||||
unset($customUserdata[$val]);
|
if(isset($customUserdata[$val])) {
|
||||||
$cookieUserdata[$val] = $this->userdata[$val];
|
unset($customUserdata[$val]);
|
||||||
|
$cookieUserdata[$val] = $this->userdata[$val];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// did we find any custom data? If not, we turn the empty array into a string
|
// did we find any custom data? If not, we turn the empty array into a string
|
||||||
@@ -76,6 +78,10 @@ class MY_Session extends CI_Session {
|
|||||||
$customUserdata = $this->_serialize($customUserdata);
|
$customUserdata = $this->_serialize($customUserdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!isset($this->userdata['user_id'])) {
|
||||||
|
$this->userdata['user_id'] = '';
|
||||||
|
}
|
||||||
|
|
||||||
// run the update query
|
// run the update query
|
||||||
$this->CI->db->where('session_id', $this->userdata['session_id']);
|
$this->CI->db->where('session_id', $this->userdata['session_id']);
|
||||||
$this->CI->db->update($this->sess_table_name, array('last_activity' => $this->userdata['last_activity'], 'user_id' => $this->userdata['user_id'], 'user_data' => $customUserdata));
|
$this->CI->db->update($this->sess_table_name, array('last_activity' => $this->userdata['last_activity'], 'user_id' => $this->userdata['user_id'], 'user_data' => $customUserdata));
|
||||||
|
|||||||
Reference in New Issue
Block a user