note 25682 deleted from function.setcookie by sniper
| From: | sniper@php.net | Date: | Wed, 11 Dec 2002 06:40:12 +0000 |
| Subject: | note 25682 deleted from function.setcookie by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-40690@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' : '')));
}