Jump to content

Recommended Posts

Personally I use sessions but also offer the user the chance have the site log them in automatically on each visit using cookies. There have been a few rules come in in the UK recently about the use of cookies but I am not sure how far down the developer chain they apply.

 

Steve

Link to comment
https://forums.phpfreaks.com/topic/265841-login-feature/#findComment-1362297
Share on other sites

Hey Steve. What do you store in the cookies to verify the users identity. I was just wondering what cookies you store to authenticate the iser. So I can compare it with what I am thinking of, and find out if my ideas are good or not.

 

Thanks for the reply!!

Link to comment
https://forums.phpfreaks.com/topic/265841-login-feature/#findComment-1362299
Share on other sites

I use sessions and cookies as well. What I usually do is store a hashed version of the user's username as well as the hashed version of the user's id. I save the hashed user's id as an auth_token. Also, I use PHPass to accomplish this.

Link to comment
https://forums.phpfreaks.com/topic/265841-login-feature/#findComment-1362312
Share on other sites

What you want do is that when ever I user logs in and checks the remember me function or whatever, you set a cookie called auth_code for example and save the value in a cookie as well as the database and associate it with that user. Then whenever a user accesses a protected page after their session has expires, you use a bit of code to check if the auth_code is present. If it is you check the database for its value and if it is present then log the user in and add a new value to the auth_code cookie and column in the database.

 

Link to comment
https://forums.phpfreaks.com/topic/265841-login-feature/#findComment-1362363
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.