Jump to content

Storing session information


php_guy

Recommended Posts

Hello guys,

 

I thought I would post another topic since it's really a separate issue.

 

How can I create a "Keep me logged in" feature where if users select this checkbox prior to typing their username/password, then the system will remember that user and they will not have to re-type their credentials everytime.

 

I know this can be done, but I'm not sure how! Maybe cookies? I'm not sure??  :-[ (Also, if possible, I want to avoid having to store the user's password in plain text on their system...can this be done?)

Link to comment
Share on other sites

Cookies should work fine. I would suggest keeping all "Keep me logged in" users in a table for their session to avoid any security issues with cookies. So, when a user logs in with the box checked to stay logged in, put their account number in a "logged in" table. Then, When you check if someone is checked in, either check for both the cookie and the entry in your db. If it's all there, then they have logged in before and aren't just manipulating cookies.

 

Here is the cookie page: http://www.php.net/manual/en/features.cookies.php

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.