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 the page– 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'] != '')) die('Access denied.'); ?>