tecmeister Posted February 11, 2008 Share Posted February 11, 2008 Hi everyone, I was wondering what the logout code is. Thanks for your tecmeister Quote Link to comment https://forums.phpfreaks.com/topic/90428-logout-code/ Share on other sites More sharing options...
EchoFool Posted February 11, 2008 Share Posted February 11, 2008 It kills sessions so that any sessions related to the user is removed the user has to log back into the site before viewing any pages related to registered users only. Quote Link to comment https://forums.phpfreaks.com/topic/90428-logout-code/#findComment-463587 Share on other sites More sharing options...
tecmeister Posted February 11, 2008 Author Share Posted February 11, 2008 So this will be the code then: session_start(); And session_destroy(); Quote Link to comment https://forums.phpfreaks.com/topic/90428-logout-code/#findComment-463590 Share on other sites More sharing options...
EchoFool Posted February 11, 2008 Share Posted February 11, 2008 yeah. Quote Link to comment https://forums.phpfreaks.com/topic/90428-logout-code/#findComment-463593 Share on other sites More sharing options...
pwes24 Posted February 11, 2008 Share Posted February 11, 2008 session_start(); //if you registered any session variables, you'll need to unregister session_unregister("SESS_USERNAME"); session_unregister("SESS_USERID"); session_destroy(); //to completely destroy session variables, set the $_SESSION to an empty array! $_SESSION = array(); Quote Link to comment https://forums.phpfreaks.com/topic/90428-logout-code/#findComment-463602 Share on other sites More sharing options...
TheFilmGod Posted February 11, 2008 Share Posted February 11, 2008 session_start(); //if you registered any session variables, you'll need to unregister session_unregister("SESS_USERNAME"); session_unregister("SESS_USERID"); session_destroy(); //to completely destroy session variables, set the $_SESSION to an empty array! $_SESSION = array(); That is incorrect. session_destroy() unsets all session related information. Quote Link to comment https://forums.phpfreaks.com/topic/90428-logout-code/#findComment-463606 Share on other sites More sharing options...
tecmeister Posted February 11, 2008 Author Share Posted February 11, 2008 Please will you be able to tell me the correct code. Quote Link to comment https://forums.phpfreaks.com/topic/90428-logout-code/#findComment-463611 Share on other sites More sharing options...
TheFilmGod Posted February 11, 2008 Share Posted February 11, 2008 <?php session_start(); session_destroy(); ?> Quote Link to comment https://forums.phpfreaks.com/topic/90428-logout-code/#findComment-463618 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.