note 16346 added to function.setcookie

From: Date: Thu, 25 Oct 2001 16:24:20 +0000
Subject: note 16346 added to function.setcookie
Groups: php.notes 
Request: Send a blank email to php-notes+get-19427@lists.php.net to get a copy of this message
Two things. First the small one -- how to delete all your site's cookies: <PRE> if (0<sizeof($HTTP_COOKIE_VARS)) {while (list ($k_cookie, $v_cookie) = each ($HTTP_COOKIE_VARS)) { setcookie($k_cookie); } } </PRE> Second, how to set a cookie for MSIE (Internet Explorer): <PRE> function ms_cookie_time($i_time) { return date("l, d-M-Y h:i:s T",$i_time); } setcookie($sz_cookie_name,$v_value,ms_cookie_time((time())),'/','.yourdomain.com'); </PRE> Netscape will accept UNIX timestamp (the number of seconds since January 1 1970 00:00:00 GMT), but MSIE will not. Bon appetit! -- http://www.php.net/manual/en/function.setcookie.php http://master.php.net/manage/user-notes.php?action=edit+16346 http://master.php.net/manage/user-notes.php?action=delete+16346 http://master.php.net/manage/user-notes.php?action=reject+16346

« previous php.notes (#19427) next »