Skip to content
Advertisement

Session gets destroyed after page refresh

Login.php

JavaScript

Index.php

JavaScript

I made a Login script which opens, if the password is correct, the Index.php site. When first opening the Index.php site via the Login script everything works fine and the session is set. But after I refresh the page the sessions gets destroyed and is not set. So how can I save the session, so it’s not getting destroyed by refreshing the browser?

Advertisement

Answer

This line in your index.php destroys your session:

JavaScript

To realize your logout process, you could link to another php file and do your session_destroy(); there – for example.

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