[eluser]Gerep[/eluser]
I'm making a login with permissions.
I have three session variables:
Code:
$this->session->set_userdata('user', $rs);
$this->session->set_userdata('views', $views);
$this->session->set_userdata('permissions', $permissions);
Those arrays are necessary so I can say if user X can access the screen Y.
My login controller if checking for the user info, add it to the session user, after that I check for this user permissions and add them to the session permissions, load all views and add them to views session.
Right after that I redirect the user to another controller: redirect('home', 'refresh'), this home controller extends MY_Controller
Here it is:
Code:
class MY_Controller extends CI_Controller {
public $_template;
public function __construct() {
parent::__construct();
$this->load->library('template');
$this->_template = new Template();
if( ! $this->session->userdata('user'))
redirect('login','refresh');
}
}
On the IF my sessions doesn't exist anymore. The session library is autoloaded.
The Home Controller:
Code:
class Home extends MY_Controller {
private $_view = 'home';
public function __construct() {
parent::__construct();
}
public function index() {
$this->_template->build($this->_view);
}
}
What is happening with my sessions?
Thanks.