Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HTTP_REFERER problems!

Status
Not open for further replies.

martinb7

Programmer
Jan 5, 2003
235
GB
Hi, i was trying to make a system that logs the visitors to my site using the HTTP_REFERER code. It will write it to a .txt file

say i have

<?php
echo $HTTP_REFERER;
?>

it works from another page if clicked by a link, but it wont work say if you typed the address in after you had been to msn.com

the page url is
how can i get round this or make it work?

is there another way?

any ideas??


Martin

Computing/Gaming help and info:

 
I am hoping that someone can come up with a way to always trace where a visitor comes from?

Maybe you can somehow get it from their history? (as in Java).

JR
As a wise man once said: To build the house you need the stone.
Back to the Basics!
 
The referer logs indicate what sites generated the traffic and which links, term, affilate logo etc was used.

I don't think you'll have much luck logging visits where the URL was manually typed in
 
sleipnir214 is absolutely right. Don't confuse the HTTP_REFERER with the REMOTE_ADDR which gives the IP that the remote client reports. It could be forwarded through a proxy though, and the X_FORWARDED_FOR headers would identify the originating IP. However, there are many ways to avoid IP reporting or spoof IPs. Internet Protocol V4 was not intended for security...
Generating stats about visitors for informational purposes is best done with one of the log processing scripts that are numerous and freely available.
 
If you want to log "every" visitor then your best bet would be to use "$REMOTE_ADDR" , as $HTTP_REFERER will only report visits which originated from a outside location "google, yahoo, another page etc
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top