Hi Craig,
You could do something like this in the top of your fail.php file:
<?php
if (empty($_SERVER['HTTP_REFERER'])) {
header("HTTP/1.0 403 Forbidden");
exit;
}
?>
However, that will only check to make sure the user hasn't come directly to the script. If they link to it from elsewhere they can still access it, which you could get around by adding a strpos or something to the if() above.
Hope that helps