Developing a login system, I wrote the following script in the controller:
$usuario = $this->input->post('usuario');
$senha = $this->input->post('uenha');
$q = $this->login->logar($usuario, $senha);
if (!$q):
$this->session->set_userdata('logado',false);
redirect('login');
endif;
$this->session->set_userdata('logado',true);
redirect('redacoes');
This is an example.
It turns out that after the redirect to another controller, the sessions are not being stored.
Note: I loaded the autoload.