I am storing loginuserid in session and destroy session on logout . login and logout work fine but my problem is when user logout and we press back button it still able to open visited page and even when he is actualy loged out .
User go to login page when we refresh the page . I want user not go to visited page even he press back button . Please help me out . Thanks in Advance .
This is actually because of the browser caching - you should disable this and use CodeIgniters Cache Library if any caching is needed.
Add the following to the pages where users are required to be logged in:
//Prevent browsers from using history to browse in the user system.
$this->CI->output->set_header("Cache-Control: no-store, no-cache, must-revalidate");
$this->CI->output->set_header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
$this->CI->output->set_header("Pragma: no-cache");
When pressing back in the browser the page will be refreshed,
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With