note 69015 added to function.setcookie

From: Date: Sat, 19 Aug 2006 20:23:39 +0000
Subject: note 69015 added to function.setcookie
Groups: php.notes 
Request: Send a blank email to php-notes+get-116088@lists.php.net to get a copy of this message
If you try to call setcookie() before issuing a 302 via a header("Location:..."), the cookie will not be sent as part of the 302 response. To get the cookie in the header, use the header() function instead of setcookie(), i.e. header("Set-Cookie: cookiename=cookievalue; expires=18-Oct-2008 GMT; path=/; domain=.www.domain.com"); Note also that PHP setcookie() formats the date without dashes, which is accepted by major browsers, but is not in accordance with the Netscape cookie spec, which specifies the date with dashes. ---- Server IP: 85.116.0.130 Probable Submitter: 86.143.87.19 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.setcookie.php Edit -- https://master.php.net/note/edit/69015 Del: integrated -- https://master.php.net/note/delete/69015/integrated Del: useless -- https://master.php.net/note/delete/69015/useless Del: bad code -- https://master.php.net/note/delete/69015/bad+code Del: spam -- https://master.php.net/note/delete/69015/spam Del: non-english -- https://master.php.net/note/delete/69015/non-english Del: in docs -- https://master.php.net/note/delete/69015/in+docs Del: other reasons-- https://master.php.net/note/delete/69015 Reject -- https://master.php.net/note/reject/69015 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#116088) next »