[eluser]ibnclaudius[/eluser]
I did this helper and put the is_not_logged_in() in the constructor of unsafe pages and the is_logged_in() in the constructor of safe page, but they are redirecting to one another without stopping.
Code:
public function is_not_logged_in() {
$session = $this->CI->session->userdata('logged_in');
if (isset($session) || $session == TRUE) {
redirect('admin', 'location');
exit();
}
}
public function is_logged_in() {
$session = $this->CI->session->userdata('logged_in');
if (!isset($session) || $session != TRUE) {
redirect('web', 'location');
exit();
}
}