Page 1 of 1

Logout and back button w/out sessions

Posted: Sat Jul 24, 2004 4:59 pm
by turbo2ltr
I'm using cookies and mySQL, but no sessions to check if a user is logged in. Everything works the way I want it. The problem arises when a user logs out, then clicks the back button. It just reloads the (I assumed cached) "logged in" page. If you refresh it will update and show that you are not logged in.

Is there any way to tell the browser not to use the cached previous page *after* you logout? Or is there another solution to this?

I did a search and only found people with session problems. And the one post I did find that sort of pertained to this didn't have any responses.

Thanks,
Mike

Posted: Sat Jul 24, 2004 5:29 pm
by kettle_drum
Try:

Code: Select all

// HTTP/1.1
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");

Posted: Sat Jul 24, 2004 5:32 pm
by turbo2ltr
Wouldn't this have to but on the page that the user was "back"ing to? And in that case I'd have to have it on every page because there is a logout button on every page. Wouldn't this have a significant impact on image reloading speed?

Posted: Sat Jul 24, 2004 5:35 pm
by turbo2ltr
Well, I tried it, and it worked.. didn't seem to effect loading speed too much..Thanks.