I am trying to design a login/logout page in codeigniter framework.My problem is that when I logout of the web-page I am getting redirected to a login page. When I go back I am getting a page which says:
Document Expired
This document is no longer available.
But when I refresh this page I am getting logged into the system again (o.O)
The following codes contain my constructor and logout functionalities. Please help me to design a perfect login logout page
function __construct()
{
parent::__construct();
$this->load->model('user_model');
$this->output->set_header('Last-Modified: ' . gmdate("D, d M Y H:i:s") . ' GMT');
$this->output->set_header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
$this->output->set_header('Pragma: no-cache');
$this->output->set_header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
}
function logout()
{
$newdata = array(
'user_name' =>'',
'user_email' => '',
'logged_in' => FALSE,
);
$this->session->unset_userdata($newdata);
$this->session->sess_destroy();
redirect('default_controller','refresh');
}
I tried find proper logout method but I am not able to.