Forum Moderators: phranque
This is strictly a php related question; try posting it on the php forum instead, the chance that you'll get your question answered is much bigger than here.
To find out exactly what you will return there put
<?php
echo $_SERVER['HTTP_REFERER'];
?>
on that page and have the if statment only show your errors there.