I'm echoing all the cookies that has been put on my system from my domain.
PHP Code:
<?
$allcookies = array_keys($HTTP_COOKIE_VARS);
$allcookievalues = array_values($HTTP_COOKIE_VARS);
if (sizeof($allcookies) == 0)
{
    echo '<br><br>TurtleTips hasn\'t put any cookies on your system.';
}
else
{
    echo '<table border="0" cellpadding="4" cellspacing="0">';
    for ($i = 0; $i < sizeof($allcookies); $i++)
    {
        echo "<tr><td><font face=\"Verdana,Tahoma,Arial,sans-serif\" size=\"1\"><b>$allcookies[$i]</b> containing <b>";
        if (strlen($allcookievalues[$i]) > 20)
        {
            echo substr($allcookievalues[$i], 0, 12);
            echo " ... ";
            echo substr($allcookievalues[$i], -7);
        }
        else
        {
            echo $allcookievalues[$i];
        }
        echo "</b> (<a href=\"/setcookie.php?name=$allcookies[$i]";
        echo "&delete=true&returnto=$PHP_SELF\">delete</a>)</font></td></tr>\n";
    }
    echo '</table>';
}
?>
The code works fine most of the time, but for some reason the last cookie echoed has this before it:
Warning: Array to string conversion in h:\header.php on line 179
The equivalent of line 179 above is:
PHP Code:
if (strlen($allcookievalues[$i]) > 20