How do I refresh a PHP page on browser back?

Hi I wonder if anyone can help.

I have a page with 2 dynamic headers. The first header shows a link to a sign-in page if the user isn’t signed in. The second header shows the users name and a link to a sign out page if they are signed in.

This all works well but I have spotted a usability problem. If the user clicks the link to the sign-in page then signs in and selects BACK the old sign-in header still shows. It looks as if they still need to sign-in, until they move off to another page then the correct header is shown.

This is probably a problem with page caching. I have tried numerous things like “header (no-cache)” and unsetting the variable I test to see if the user is logged in all to no avail. I could test for a session variable but as with the header option - i am developing a template to be used on multiple websites and I don’t want to require a session_start at the top of each page. I would prefer to keep my solution self-contained in the header.

Has anyone had this problem before and is there an easy way to solve it?

Thanks for your help
Steven

There’s no way.

When a user hits the browser back button, it’s not re-requesting the page from the server, it’s cached on the browser. It’s possible some browsers might re-request it depending on settings but not all do.

In theory you send the cache headers to stop the browser from caching and requiring it to reload the page. In practice some browsers ignore these headers.