Jump to content

Logging Out???


dubt2nv

Recommended Posts

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
Share on other sites

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
Share on other sites

if you're using cookies
whatever 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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.