There are a couple of reasons:
The Refer tag is send by your browser to the server, but...
Some 3rd party apps on your system can strip these off
If you are using a proxy server it can strip them off
If you call the script directly, there is no referer tag sent because it is the 1st page you visited.
Hope that helps but the manual is right, that tag is unreliable.