<?

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

if ($count == "")
	$count = 1;
else
{
	$count++;
	$last_visit = $d[count($d) - 1];
}

$d[0] = $count;
$d[] = date('M d, Y, H:i:s T');

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 ", $d[0], " times since $d[1].</p>\n";
	echo "<p>Your last visit was on $last_visit.</p>\n";
}

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