well, my first thought was to check if that page has a http_refer value. that means that it was clicked from 'somewhere' to get to that current page.
here's what i mean.
<?php
// put this on very top of file.php
if($_SERVER['HTTP_REFERER']){ //same as if($_SERVER['HTTP_REFERER'] == "")
echo "person clicked on a link to get here";
// show content of file.
}
else{
echo "person must have typed in the URL to get here";
// redirect user to another page using a the header() function
}
?>
also a safer way to do this is changing
if($SERVER['HTTP_REFERER']){
to
if($SERVER['HTTP_REFERER'] == "http://www.page.com/link_to_page.html"){
because the first way of doing so, just checks if you got to the page via any link on any page, while the other one specifies which page did the link must have come from.
hope i didn't confuse ya.