I'm trying to create a simple login/logout feature of a project and my problem is that when I try to logout, the page doesn't redirect to my original login page.
My Admin model goes like this
public function __construct() {
parent::__construct();
$this->load->model('AdminModel');
$this->load->library('session');
if($this->session->userdata('logged_in')){
redirect('item/index');
}
}
public function logout(){
$this->session->sess_destroy();
redirect('admin/index', 'refresh');
}
This line redirects the page to the home if a user who is logged in tries to access other forbidden pages, however when I logout, it only redirects me to the same user's home page.
if($this->session->userdata('logged_in')){
redirect('item/index');
}
Thank you.
$this->session->unset_userdata();beforesess_destroy- Zeeshanreturn redirect('page')- killstreet