koryw has asked for the wisdom of the Perl Monks concerning the following question:
I have a perl cgi-bin process that creates a cookie and puts the user in a queue position associated with a mysql database. I reload the page every 45 seconds and that updates their queue position and cookie. The reason why the cookie is update is, because we set it to expire +1m, so if they leave the page their cookie expires, or if they close the browser it expires, but as long as they let the reload happen they will have their cookie updated to not expire for another minute. Onces they reach 1 on the queue, I expire their cookie (I set the expires field to -1y) and delete their session id and remove the Mysql record and redirect the users to a login page along with the cookie expire change.
Here is the strange part the session id deletes fine, Mysql deletes fine, but the cookie is still there for maybe two more minutes before it gets expired. I thought sending the cookie the past years time would immediatley expire the cookie when sent to the browser header.
What I'm I doing wrong. I'm using CGI::COOKIE. Code below for expiring cookie
my $cookieHandle = $cgi->cookie(-name=>$PHQConf{COOKIE_NAME}, -value=> +$sessionObj->id, -expires=>'-1y'); print $cgi->redirect(-uri=>$target, -cookie=>$cookieHandle);
20030329 Edit by Corion : Added formatting
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
•Re: cookie expire question
by merlyn (Sage) on Mar 29, 2003 at 14:32 UTC | |
by theorbtwo (Prior) on Mar 29, 2003 at 14:42 UTC | |
by merlyn (Sage) on Mar 29, 2003 at 15:09 UTC | |
|
Re: cookie expire question
by Jaap (Curate) on Mar 29, 2003 at 10:11 UTC | |
|
Re: cookie expire question
by powerhouse (Friar) on Mar 29, 2003 at 21:59 UTC |