I am trying to design a login/logout page in code igniter 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.
My Login controller is
public function __construct() {
parent::__construct();
//date_default_timezone_set("Asia/Kolkata");
$this->load->helper(array('form', 'url'));
$this->load->database();
$this->load->model('User_model');
$this->load->library(array('session', 'form_validation', 'email'));
$this->load->file('smtp/Send_Mail.php');
$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() {
$user_data = $this->session->all_userdata();
foreach ($user_data as $key => $value) {
if ($key != 'session_id' && $key != 'ip_address' && $key != 'user_agent' && $key != 'last_activity') {
$this->session->unset_userdata($key);
}
}
$this->session->sess_destroy();
redirect('Login');
}
Login view page where i checked if session is exists then redirect on other page.
<?php
if($this->session->is_user_login==TRUE)
{
redirect('User/Emailverification');
}
?>
I am not getting how to resolve this document expired error.I have dono lots of searching but i am not getting the solution of this problem.Please help me thanks in Advance.