note 20276 deleted from function.setcookie by sniper
| From: | sniper@php.net | Date: | Wed, 11 Dec 2002 07:17:54 +0000 |
| Subject: | note 20276 deleted from function.setcookie by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-40730@lists.php.net to get a copy of this message | ||
I've just spent the last few days battling with another bug in IE (5.50.4134.0100)!
I was making an active users list, which checks for a cookie and if there isn't one it adds a
new line in a MySQL table. Sounds fine and it worked well until suddenly I found there were extra
people appearing in it, with exactly the same details except no username.
After some testing I found that this happened whenever I pressed Refresh quickly repeatedly.
After days of searching I finally tracked this down to a bug in IE where if I set the directory it
would not send the cookies on the fast refreshes, although it worked on the normal loads.
My advice to you is if you are relying on cookies for an active users list, don't set the
directory in the setcookie()! I now use setcookie("Name", $ID) and it works fine in both
IE5 and NS4.
Also, for anyone who already has one of these, if you change your code you must change the cookie
name as well, as it will not replace the old cookie which could override it and create even more
problems with extra lines (I got an extra line per reload!)