tecmeister Posted February 11, 2008 Share Posted February 11, 2008 Hi everyone, I was wondering what the logout code is. Thanks for your tecmeister 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. 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(); 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. 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(); 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. 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. 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(); ?> Link to comment https://forums.phpfreaks.com/topic/90428-logout-code/#findComment-463618 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.