Click here to Skip to main content
15,888,816 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Good day and thanks for your forum. I am creating a php script that runs a session. I can login to the session from the login page and when I run my logout script it takes me to the Goodbye page. However, when I click the back button on the browser after I get to my Goodbye page it takes me back to the previous page as if I were still logged in. How can I fix this issue? Below is the logout script as given by php.net. On the Goodbye page, I also have tried using the standard logout like session_unset and session_destroy and redirect to the login page. When I am redirected to the login page and click the browser next button it takes me back to the previous page as if I was still logged into it.

What I have tried:
Posted
Updated 13-Aug-22 2:00am

1 solution

By default the Back button goes to a copy of the page that was cached in the browser - it doesn't "revisit" your site. So change you made later aren't reflected in the page you go back to.

There are two ways you can do this: either disable the Back button, or mark your pages as non-cacheable.
This may help: How To Disable Back Button In Php - Pakainfo[^] or this: php: howto control page caching header[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900