I have two sites that perform user authentication and soon after creating a session for it, both sites access the same database and therefore the user structure returned by the statement:
$usuario = $this->db->get('usuarios').result();
has the same fields, the session is created like this:
$this->session->set_userdata(array('logged' => true, 'usuario' => $usuario[0]));
All pages of both sites redirect the user to the login screen if the logged
field is not set to true
in the session, the sites work normally (I can even open multiple tabs for the same site), however , if I authenticate to one of them and try to access any page from the other, the created sessions are destroyed (on both sites if they exist). I'm using:
codeigniter 2.2.1, PHP / 5.4.19, Apache / 2.4.4
.
I really have no idea why.