I'm working on a counter script that generates stats about how many hits a site has, and at what timeperiodes , and what browserversion etc etc.

It is a php file, imbedded in a normal html page through image tags. So something like this :
Code:
<img src="http://www.mysite.com/counter.php">
Most of it is working, but I'm kinda stuck at the part where I want to log from what other site the visitors came from.

the data flow is like this:

[1: some other site that has links to page (2) ] -> [2: a html page with my counter embedded] -> [3:my counter.php that loads whenever (2) is loaded]

I tried to use getenv("HTTP_REFERER" ) on my counter (3) , but this only shows the url of (2) , so the html page that carries the counter.

I cant use this method on (2) because this is a html page. (I'm making this counter for some friends, and they just have simpel html pages and cant switch to php)

Now.. is there some way that the counter script can actually find out what the url was of (1), aka the site where the visitors where before they came to the site ? It should go back two steps in time, and I somehow doubt its possible.

[edit] copied something wrong, it said HTTP_HOST first but in the script i already used HTTP_REFERER in fact, sorry for the confusion :s