Explanation of cookie behavior
| From: | Ryan Schefke | Date: | Thu, 15 Apr 2004 14:42:52 +0000 |
| Subject: | Explanation of cookie behavior | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-183464@lists.php.net to get a copy of this message | ||
Gurus,
I'm running a login script where the user enters login/password and if it
matches what I have in my db and their account is active, I set a login
cookie (login_ck) and an authentication cookie (authenticate_ck). If the
login and authentication cookies are set when the user goes back to the
login page I prompt with "welcome back.". Now, I refresh the login page a
few times, sometimes it gives the welcome back prompt. Then after anywhere
from 2-5 refreshes, it deletes the login cookie but the authenticate cookie
persists. Any ideas why this is happening?
I'm setting my cookies like this:
setcookie ("authenticate_ck", "$daysRemaining"); //set cookie for active
account, for 30days
setcookie ("login_ck", "$lo", time()+ "60*60*24*30", "",
"", "0"); //set
cookie for login, for 30days
Thanks,
Ryan