as noted yesterday, Your problem is that HTTP_REFERER is empty because of a browser implementation. Some browsers don't send it when they sense a dynamic page some do. Some dont send it at all, some firewalls block it. In short IT IS NOT WHAT YOU ARE LOOKING FOR.
-Waswas
Comment on Re: Missing referer argument during redirection