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... ??? Link to comment https://forums.phpfreaks.com/topic/26529-logging-out/ 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? Link to comment https://forums.phpfreaks.com/topic/26529-logging-out/#findComment-121379 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. Link to comment https://forums.phpfreaks.com/topic/26529-logging-out/#findComment-121381 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 Link to comment https://forums.phpfreaks.com/topic/26529-logging-out/#findComment-121382 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] Link to comment https://forums.phpfreaks.com/topic/26529-logging-out/#findComment-121395 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.