Welcome Guest, Not a member yet? Register   Sign In
how to solve reloading previous page after unset_userdata() or sess_destroy() used in logout function????
#1

[eluser]mythilisubramanyam[/eluser]
i have a function called logout in my Controller for destroying session and redirecting to login page,

Code:
function logout()
{
   $this->session->unset_userdata('empid');
   $this->session->sess_destroy();
   if(!$this->session->userdata('empid'))
   {
       $this->load->view('login');
    }

}

in this function empid value is cleared and login page is loaded.
if i click back in the browser the previous page is reloaded.

but the previous page shouldn't be reloaded,
even i checked for sesion empid value for the previous page to load,
even then its not working ....

can any one give a solution for this,
#2

[eluser]kurucu[/eluser]
Often caching is the problem (in the browser) although controlling/predicting this can vary from server to proxy to client.

There is an interesting article here which provides some strange solutions. Look into HTTP headers and whatnot for a better solution.
#3

[eluser]brianw1975[/eluser]
Now yer heading into some headache-y territory..

You can set PRAGMA NOCACHE, just make sure you configure your webserver to set far-future expiration dates on your other content (images, css, js, etc) otherwise you are looking at random acts of complete page reload in various browsers.

There is no easy way to deal with this...if you programmed correctly, even if they do hit the back button anything that they might try to do will require them to log in again.


UPDATE:

Actually... If you are trying to protect corporate data on unsafe networks then you could put in a checkbox in the login (like banks, etc do) that the user could check when logging in that you could then set the headers so that the page wouldn't be cached.




Theme © iAndrew 2016 - Forum software by © MyBB