dubt2nv Posted November 8, 2006 Share Posted November 8, 2006 I am currently making a website using php for a project at tafe....and am wondering what php code i should use to allow the user to log out properly without the ability for people to return to the log-in pages by pressing back.....basically i have a log-in form that only allows users to log-in if the user has their details entered into the database....and i am jus wondering how i would make the log-out button actually log-out... ??? Quote Link to comment Share on other sites More sharing options...
leeming Posted November 8, 2006 Share Posted November 8, 2006 you using sessions or cookies? or are you just passing the user name/id over every page? Quote Link to comment Share on other sites More sharing options...
fiddy Posted November 8, 2006 Share Posted November 8, 2006 Hope you create a session as soon as the user logs in and you are checking in all the pages if that session exists(if not redirect to login page) . When logging out you can clear all sessions (session_unset();) and redirect to some other page with some message. Quote Link to comment Share on other sites More sharing options...
fiddy Posted November 8, 2006 Share Posted November 8, 2006 If you use cookies , you have to do the same but reset the cookie Quote Link to comment Share on other sites More sharing options...
Skatecrazy1 Posted November 8, 2006 Share Posted November 8, 2006 if you're using cookieswhatever cookie is keeping the user logged in, set it empty:[code]setcookie("cookie_logged_in", "", time()+36000);[/code]if you're using sessions, which I hope you are, look up [url=http://www.php.net/session_destroy]session_destroy()[/url] and [url=http://www.php.net/session_unset]session_unset()[/url] Quote Link to comment 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.