Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple cookies with same name

I just figured out that I have a problem in IE while working with one of my pages. I set cookie with:

setcookie('page', '12345', '2000000', '/');

And if I login I reset the cookie calling that function again. In firefox everything works fine cause the old cookie is deleted but in IE both cookies stay? How can this happen? Isn't that illegal?

now I fixed that with:

setcookie('page', '', time() - 3600, '/');
setcookie('page', '1234', '2000000', '/');

Is this ok solution or am I missing something?

like image 766
dfilkovi Avatar asked Oct 21 '25 23:10

dfilkovi


1 Answers

According to the documentation, that is the correct way to remove a cookie.

like image 52
Jordan Ryan Moore Avatar answered Oct 23 '25 16:10

Jordan Ryan Moore



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!