note 48621 added to function.setcookie

From: Date: Sun, 02 Jan 2005 07:01:49 +0000
Subject: note 48621 added to function.setcookie
Groups: php.notes 
Request: Send a blank email to php-notes+get-82559@lists.php.net to get a copy of this message
I had great trouble deleting a cookie. I tried to use: setcookie('SSID','blahblahblah',3600,'/'); setcookie('SSID',false); This did not work, although debugging the headers show that PHP sent a "X-SET-COOKIE: SSID=deleted" header, Firefox ignores this and resends the cookie after closing en restarting the browser. The correct way to destroy a cookie: setcookie('SSID','blahblahblah',3600,'/'); setcookie('SSID',false,-3600,'/'); Thus set the expire time in the past and use the very same paramters as stated in the manual page above. Except the value of course, it should be false (without ' '). ---- Manual Page -- http://www.php.net/manual/en/function.setcookie.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+48621 Delete -- http://master.php.net/manage/user-notes.php?action=delete+48621&report=yes Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+48621&report=yes&reason=bad+code Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+48621&report=yes&reason=spam Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+48621&report=yes&reason=useless+example Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+48621&report=yes&reason=contains+commercial+links Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+48621&report=yes&reason=useless+note Reject -- http://master.php.net/manage/user-notes.php?action=reject+48621&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#82559) next »