note 71976 added to function.setcookie
| From: | venkatesh at kamakoti dot org | Date: | Wed, 27 Dec 2006 10:40:33 +0000 |
| Subject: | note 71976 added to function.setcookie | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-120945@lists.php.net to get a copy of this message | ||
A correction to Jos� Enrique Serrano Exp�sito's function sHTTP_COOKIE_VARS()
for "listing all cookies"...
Use $_COOKIE instead of $HTTP_COOKIE_VARS in the forEach loop...
Complete corrected code is:
For listing all the cookies readed in the client machine.- echo sHTTP_COOKIE_VARS();
<?php
function sHTTP_COOKIE_VARS() {
global $HTTP_COOKIE_VARS; // $HTTP_COOKIE_VARS is not exist in a function
$sEcho = '';
$iCookies = 0;
ForEach( $HTTP_COOKIE_VARS As $vIndex => $vValue ) {
$iCookies++;
if( is_array( $vValue ) ) {
foreach ( $vValue as $vIndex2 => $vValue2 ) {
$sEcho .=
'$HTTP_COOKIE_VARS[\'<b>'.$vIndex."</b>']['".$vIndex2.'\']
== "'.
$vValue2.'"<br>';
}
} else {
$sEcho .= '$HTTP_COOKIE_VARS[\'<b>'.$vIndex.'</b>\'] ==
"'.
$vValue.'"<br>';
}
}
$sEcho .= $iCookies.' cookies listed.';
return $sEcho; ///
}
?>
Have fun :-)
Regards
Venkatesh
----
Server IP: 85.116.0.130
Probable Submitter: 217.33.48.235 (proxied: 1.1 LONISA1)
----
Manual Page -- http://www.php.net/manual/en/function.setcookie.php
Edit -- https://master.php.net/note/edit/71976
Del: integrated -- https://master.php.net/note/delete/71976/integrated
Del: useless -- https://master.php.net/note/delete/71976/useless
Del: bad code -- https://master.php.net/note/delete/71976/bad+code
Del: spam -- https://master.php.net/note/delete/71976/spam
Del: non-english -- https://master.php.net/note/delete/71976/non-english
Del: in docs -- https://master.php.net/note/delete/71976/in+docs
Del: other reasons-- https://master.php.net/note/delete/71976
Reject -- https://master.php.net/note/reject/71976
Search -- https://master.php.net/manage/user-notes.php