note 73484 added to function.setcookie

From: Date: Sun, 25 Feb 2007 15:25:45 +0000
Subject: note 73484 added to function.setcookie
Groups: php.notes 
Request: Send a blank email to php-notes+get-123856@lists.php.net to get a copy of this message
If you want to delete all cookies on your domain, you may want to use the value of: <?php $_SERVER['HTTP_COOKIE'] ?> rather than: <?php $_COOKIE ?> to dertermine the cookie names. If cookie names are in Array notation, eg: user[username] Then PHP will automatically create a corresponding array in $_COOKIE. Instead use $_SERVER['HTTP_COOKIE'] as it mirrors the actual HTTP Request header. <?php // unset cookies if (isset($_SERVER['HTTP_COOKIE'])) { $cookies = explode(';', $_SERVER['HTTP_COOKIE']); foreach($cookies as $cookie) { $parts = explode('=', $cookie); $name = trim($parts[0]); setcookie($name, '', time()-1000); setcookie($name, '', time()-1000, '/'); } } ?> ---- Server IP: 69.147.83.197 Probable Submitter: 210.7.27.91 ---- Manual Page -- http://www.php.net/manual/en/function.setcookie.php Edit -- https://master.php.net/note/edit/73484 Del: integrated -- https://master.php.net/note/delete/73484/integrated Del: useless -- https://master.php.net/note/delete/73484/useless Del: bad code -- https://master.php.net/note/delete/73484/bad+code Del: spam -- https://master.php.net/note/delete/73484/spam Del: non-english -- https://master.php.net/note/delete/73484/non-english Del: in docs -- https://master.php.net/note/delete/73484/in+docs Del: other reasons-- https://master.php.net/note/delete/73484 Reject -- https://master.php.net/note/reject/73484 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#123856) next »