Hello,
I'm getting confused with a session issue...
I'm using a parent controller (MY_Controller) for all others controllers. Each of them is correctly initiated with parent::__construct() and everything is going well.
Right now, I'm doing the backoffice part of my site and so, I need to store a flag for identified users.
PHP Code:
class MY_Controller extends CI_Controller
{
public function __construct()
{
parent::__construct();
$this->load->library->('session');
}
}
PHP Code:
class Backoffice extends MY_Controller
{
public function __construct()
{
parent::__construct();
}
public function index()
{
if ( ! $this->session->has_userdata('is_logged') )
$this->load->view('login');
else
$this->load->view('admin');
}
public function login()
{
if ( $this->input->post('user') == 'user' && $this->input->post('passwd') == 'passwd' )
$this->session->set_userdata('is_logged' => 1);
}
}
My problem is that session always gets empty unless I do not use the CI Session library and therefore uses $_SESSION from native php.
I just dont get what part is wrong in my code.
Ps: I've tried using both files or database driver in application/config/config.php but without any changes.