note 94431 added to function.setcookie
| From: | aziz | Date: | Wed, 04 Nov 2009 19:07:08 +0000 |
| Subject: | note 94431 added to function.setcookie | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-162400@lists.php.net to get a copy of this message | ||
By deleting cookies you should think server side too.
In this example:
<?php
// set the expiration date to one hour ago
setcookie ("TestCookie", "", time() - 3600);
setcookie ("TestCookie", "", time() - 3600, "/~rasmus/",
".example.com", 1);
?>
deletes just client side cookies.
You should use bellow example to delete both client and server side cookies:
<?php
// set the expiration date to one hour ago
setcookie ("TestCookie", "", time() - 3600);
unset($_COOKIE['TestCookie'];
// or
setcookie ("TestCookie", "", time() - 3600, "/~rasmus/",
".example.com", 1);
unset($_COOKIE['TestCookie'];
?>
----
Server IP: 69.147.83.197
Probable Submitter: 88.244.82.153
----
Manual Page -- http://www.php.net/manual/en/function.setcookie.php
Edit -- https://master.php.net/note/edit/94431
Del: integrated -- https://master.php.net/note/delete/94431/integrated
Del: useless -- https://master.php.net/note/delete/94431/useless
Del: bad code -- https://master.php.net/note/delete/94431/bad+code
Del: spam -- https://master.php.net/note/delete/94431/spam
Del: non-english -- https://master.php.net/note/delete/94431/non-english
Del: in docs -- https://master.php.net/note/delete/94431/in+docs
Del: other reasons-- https://master.php.net/note/delete/94431
Reject -- https://master.php.net/note/reject/94431
Search -- https://master.php.net/manage/user-notes.php