HTTP_REFERER error, alternative needed

I have a simple registration form that should track the number of calls from one specific external reviewer. This is a simple task with PHP:

$_SERVER['HTTP_REFERER']

however it is empty. After some research, I tried using some javascript:

document.referrer

Still empty .:(

I really don't need anything complicated, but I'm trying NOT to use awstats.
Is there any other way to get an abstract (hacking accepted)? Or am I stuck in statistics ???

-Thanks

+6
source share
2 answers

In short: if the user does not want this, you will never know where he is from. However, a more β€œreliable” solution would be to add a referrer to the link from the source site to yours. Sort of

 <a href="http://example.com/index.php?referrer=originId">Visit example.com</a> 

This requires that external sites cannot just link to your site, but you always need to add your personal identifier. If this is not possible, you cannot do anything.

It is possible that someone could change this identifier too.

+11
source

The sender is possibly sent in the header of the HTTP request.

The browser may not even send it, or some proxy, firewall, or security package has not been deleted or even changed. You cannot rely on this.

There is only one thing you can do: if it is empty, consider that you do not know the abstract.

+7
source

Source: https://habr.com/ru/post/889972/


All Articles