On the first page:
<?php
setcookie("last_page", $_SERVER['PHP_SELF']);
?>
On the second page:
<?php
if (!strstr($_COOKIE['last_page'], $_SERVER['HTTP_REFERER'])) {
print("Aha, I've caught you!");
}
?>
That won't work with Netscape, and I haven't tried it, it's off the top of my head, so it might not work.