I made a page to record the http_referer of all visitors to a webpage. It seems to work for most cases, but when I try it myself I find that the value is not filled in for my own visits.
Is this value only filled in when I come to that page through a link from a different page? What other cases would this be left empty?
http_referer question
Moderator: General Moderators
-
jaymoore_299
- Forum Contributor
- Posts: 128
- Joined: Wed May 11, 2005 6:40 pm
- Contact:
Re: http_referer question
Yes, that's the whole point of an HTTP_REFERER. It holds the url of the page that referred you to the one you're on.jaymoore_299 wrote: Is this value only filled in when I come to that page through a link from a different page?
On a side note, using HTTP_REFERERS for anything else than non-crucial statistics (read: fun facts) isn't a good idea. The HTTP_REFERER, as the name states, is sent int he HTTP request, which can be easily altered to show a different url. What the browser can do, you can do to.
- blacksnday
- Forum Contributor
- Posts: 252
- Joined: Sat Jul 30, 2005 6:11 am
- Location: bfe Ohio :(
this is part of what i use to track users on my site
So it will tell me initially who referred them, then once on site
it shows what page they are on and what page they were previously on.
Code: Select all
//whats their IP
$host = $_SERVER['REMOTE_ADDR'];
//where did they come from
$uri = $_SERVER['HTTP_REFERER'];
//what page are they requesting
$page = $_SERVER['REQUEST_URI'];
//what browser agent are they using
$browser = $_SERVER['HTTP_USER_AGENT'];
if ( $host == 'my.ip.here' )
{
//so i dont include myself in the stats
//only works if IP stays the same
}else{
insert stats to db here
}it shows what page they are on and what page they were previously on.
- blacksnday
- Forum Contributor
- Posts: 252
- Joined: Sat Jul 30, 2005 6:11 am
- Location: bfe Ohio :(
As I said, as long as you don't use HTTP data from the client for anything but fun-facts, you're fine.blacksnday wrote:for my stats purposes it doesnt matter.Sami wrote:User agent is just as unreliable as Referer
if i needed to control security, then obvisiouly that route
would not be used.
Err...what was it you wanted to know?