Re: How do you delete a cookie on the spot?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have never personally used cookies, but something I read recently indicated the following.

This is in relation to a browsers implementation of cookie behaviour:

1. The way you delete a cookie is to set it's expiry date to a date in the past
2. Browsers are not required to delete the cookie immediately. The timing
   of their clean-up process is browser dependent.

Obviously you want to take note of point 2.

You may want to consider, as an alternative approach, using session variables to store information. Using session variables, the data is stored on the server side and you have more accurate control over it's values.

Good luck ... Ross

At 08:56 AM 31/05/2004, you wrote:
Hi, can anyone tell me how to clear a cookie when the line comes up?
Because the following: setcookie("name",""); does work yes, but not well enough.
I need it to remove that cookie there and then.


For example:

You go through a login process to access a page, it sets a cookie with username and password so it registers you as being logged in.

When you click a link which directs you to a logout page, it will clear the cookie.

This is all well and good but if you retype the url to get back to the page, e.g. http://server/main/ it will still state that you have logged in.

This seems to be flying all over the place, can anyone help? Please don't direct me to the PHP Manual or any other place as I have already checked.

Many thanks,
Dan


. Ross Honniball                  JCU Bookshop Cairns Supervisor
. James Cook Uni, McGreggor Rd, Smithfield, Qld. 4878, Australia
. Ph:07.4042.1157  Fx:07.4042.1158   Em:ross@xxxxxxxxxxxxxxxxxxx
. There are no problems. Only solutions.

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux