note 71976 deleted from function.setcookie by bjori

From: Date: Wed, 27 Dec 2006 13:38:45 +0000
Subject: note 71976 deleted from function.setcookie by bjori
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-120951@lists.php.net to get a copy of this message
Note Submitter: venkatesh at kamakoti dot org Reason: bad code ---- 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

« previous php.notes (#120951) next »