Hello guys i am using CodeIgniter Framework, i have a problem within after logout, the session is already destroyed and redirect to login form, and after redirecting to login form, the browser back button can be backed to dashboard but there are errors because of the session was destroyed already. All i want is to disable the back button of the browser or anything that my previous cant be loaded. I have read other posts about this problem and tried their solution but it doesn't work. I have already pasted this code based on what I've read in other post in my constructor.
The code that I've seen from the post and posted in my constructor :
header("cache-Control: no-store, no-cache, must-revalidate");
header("cache-Control: post-check=0, pre-check=0", false);
// HTTP/1.0
header("Pragma: no-cache");
// Date in the past
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
// always modified
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
here is my logout:
$sess_array = array(
'username' => ''
);
$this->session->unset_userdata('logged_in', $sess_array);
$this->session->sess_destroy();
redirect('auth', 'refresh');
here is from my dashboard :
<li>
<a href="<?= base_url('auth/logout') ?>"><i3 class="glyphicon glyphicon-off"></i3> Logout</a>
</li>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…