note 25682 added to function.setcookie
| From: | scb at rack1 dot php dot net | Date: | Wed, 02 Oct 2002 08:26:26 +0000 |
| Subject: | note 25682 added to function.setcookie | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-37518@lists.php.net to get a copy of this message | ||
This works for me every time in a special Browser class I've created:
function setCookie ($_Name, $_Value, $_Expires = 0, $_Path = '/', $_Domain = NULL,
$_Secure = 0)
{
if (!$_Domain) $_Domain = '.' . $_SERVER['HTTP_HOST'];
header (sprintf ('Set-Cookie: %s=%s;%s path=%s; domain=%s%s', $_Name, $_Value,
(($_Expires) ? sprintf (' expires=%s GMT; ', gmdate ('D, d-M-Y H:i:s',
$_Expires)) : ''), $_Path, $_Domain, (($_Secure) ? '; secure' : '')));
}
--
http://www.php.net/manual/en/function.setcookie.php
http://master.php.net/manage/user-notes.php?action=edit+25682
http://master.php.net/manage/user-notes.php?action=delete+25682
http://master.php.net/manage/user-notes.php?action=reject+25682