Skip to content
Advertisement

How can I disable the back browser button after user press logout and destroy session?

I am having trouble with session_destroy().

When the User press Log out it have to destroy the session. I wrote the following code:

Logout.php

JavaScript

After pressing log out, when I press the browser back button it is showing my previous Logined user page and session username in Login.php page

Login.php

JavaScript

LoginViewController.php

JavaScript

I don’t know why it is working like that.

Please help me to find out where I commit mistake.

I want to disable that browser back button after logout.

Advertisement

Answer

login.php page :

JavaScript

LoginViewController.php :

JavaScript

And add the headers to force the browser to revalidate the pages :

logout.php :

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement