<?

$expires = time() + 60 * 60 * 24 * 30; // Expires after 30 days.
$d = unserialize(stripslashes($_COOKIE['all']));
$count = $d[0];

if ($count == "")
{
	$count = 1;
	$first_visit = date('M d, Y, H:i:s T');
}
else
{
	$count++;
	$first_visit = $d[1];
}

$d[0] = $count;
$d[1] = $first_visit;

setcookie('all',serialize($d), $expires);

echo "<html><head></head><body><center>\n";

if ($count == 1)
{
	echo "This is your first visit to this homepage.<br>\n";
}
else
{
	echo "<p>You visited the homepage ", $count, " times since $first_visit.</p>\n";
}

echo "</center></body></html>\n";
?>
