[eluser]Unknown[/eluser]
Hello all...
I'm having some problems with native session library and I think it's time to ask for help..
To the point...
I have table in db gathering all the informations I need. One of them is the info if a user is logged in or not. There is field called "logged_in" in db which is ENUM 0 or 1. When user logs off (destroys the session) the state is beeing updated. The problem is that it does not update when session expires. Already tried to extend the session library with two more lines changing the login state, but it just didn't work:
Code:
function sess_destroy()
{
// Kill the session DB row
if ($this->sess_use_database === TRUE AND isset($this->userdata['session_id']))
{
$user = $this->CI->db->where('email', 'xxx')->get('registered_users')->row();
$this->CI->db->where('id', $user->id)->update('registered_users', array('logged_in' => '0'));
$this->CI->db->where('session_id', $this->userdata['session_id']);
$this->CI->db->delete($this->sess_table_name);
}
// Kill the cookie
setcookie(
$this->sess_cookie_name,
addslashes(serialize(array())),
($this->now - 31500000),
$this->cookie_path,
$this->cookie_domain,
0
);
}
Any sugestions on this?
Another question. Is there any way to add cookie path to the session? Assuming I'm developing back-end and front-end both with login method?