Restricted site access

Here is the script. It will only allow those with an IP address of 111.222.333.44 to the page.
The question is how to let only those who went from here site.com/index.phpto the page site.com/index.php– I know that this is through REFERER. Is this even possible or not?


Answer 1, authority 100%

<? if (empty($_SERVER['HTTP_REFERER']) || ($_SERVER['HTTP_REFERER'] != 'http://site.com/index.php')) die('Access denied.'); ?>