I want to keep a user logged in as long as possible. What should I use?
- regular cookie
- persistent cookie
- flash cookie
- ip address
- session
or some combination of these?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I think a Flash cookie would probably stay around the longest for the simple reason that most people don’t clear them too often. They don’t show up in the usual browser dialogs and aren’t cleared by the usual ‘clear cookies’ feature.
Trying to tie a user to an IP address is useless and downright insecure if you’re trying to keep people logged in. IP addresses change often and you shouldn’t rely on it for anything serious.
I guess the best thing to do is use both a normal browser cookie and a Flash cookie. That way you catch all the Flash-less users (or those who block Flash by default) just in case.