Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

longest lasting cookie

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?

like image 708
chat Avatar asked Apr 22 '26 16:04

chat


1 Answers

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.

like image 183
chroder Avatar answered Apr 28 '26 00:04

chroder



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!