TechnoDiver Posted August 28, 2021 Share Posted August 28, 2021 I was just researching how to make a proper logout form, seems easy enough. I noticed that a lot of the examples started with session_start(). Are they saying to start it again before destroying it? I don't understand those examples, also a few examples didn't even destroy it but just unset() everything. I also moved my session_start() from config.php to my login handler, it seemed more logical to me. So 2 questions: What IS the proper way to handle a logout - a) start session again to destroy it right away b) just destroy it c) simply unset everything? My heart chooses b) but I've been wrong many times with things that I thought made sense. Also, the session_start() - config.php or login.php? Is there a performance or security difference I should be considering? Good weekend to you all. TIA for responses. Quote Link to comment https://forums.phpfreaks.com/topic/313617-logout/ Share on other sites More sharing options...
requinix Posted August 28, 2021 Share Posted August 28, 2021 Try removing the session_start() and see what happens. Also try reading the documentation for sessions and session_destroy() to see what PHP says you should be doing. Quote Link to comment https://forums.phpfreaks.com/topic/313617-logout/#findComment-1589431 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.