<?php SetCookie("MyCookie","red"); ?>.
The value of my cookie is <?php InsertCookie("MyCookie"); ?>.
InsertCookie( cookie )
<?php
//-----------------------------------------------------
// InsertCookie($cookie)
// - - - - - - - -
// Prints the value of the cookie $cookie.
//-----------------------------------------------------
function InsertClient($cookie)
{
print $HTTP_COOKIE_VARS[$cookie];
}
?>
<?php if( ShowCookie("MyCookie","orange yellow") ) { ?>
This is displayed if the cookie MyCookie contains 'orange' or 'yellow'.
<?php } ?>
ShowCookie( cookie, values )
<?php
//-----------------------------------------------------
// ShowCookie($cookie,$values)
// - - - - - - - -
// Returns true if the cookie $cookie contains any of
// the values in $values.
//
// $values should be formatted:
// "value1 value2 value3 ..."
//-----------------------------------------------------
function ShowCookie( $cookie, $values )
{
if( !is_array($values) )
$values = explode(" ",trim($values));
while( $val = each($values) )
{
$v = trim($val[value]);
if( strlen($v) > 0 )
if( stristr($HTTP_COOKIE_VARS[$cookie], $v) )
return true;
}
return false;
}
?>
<?php if( HideCookie("MyCookie","blue") ) { ?>
This is hidden if the cookie MyCookie contains 'blue'.
<?php } ?>
ShowCookie( cookie, values )
<?php
//-----------------------------------------------------
// HideCookie($cookie,$values)
// - - - - - - - -
// Returns false if the cookie $cookie contains any of
// the values in $values.
//
// $values should be formatted:
// "value1 value2 value3 ..."
//-----------------------------------------------------
function HideCookie( $cookie, $values )
{
return !ShowCookie($cookie,$values);
}
?>