Forum Moderators: coopster
if someone has no referrer then they may have typed it in to the location bar but browsers don't always give you a referrer so it may just be that you don't have access to it.
for a refresh, I don't know if it would show itself as the referrer, I don't believe it does but you would have to test it out. I don't think it would but who knows.
the var you want to play around with would be $_SERVER['HTTP_REFERER']
you may have more options with a javascript solution
So forget using referrer. How about this :
- you can grab the user's IP ($_SERVER['REMOTE_ADDR']) and then see if the last page requested is the same as the current page.
- you can create a session variable and see if the last page requested was the same as the current page.
In both of these cases, you would get a "hit" for a user who is on the home page and hits a link to the home page, for example. You could use Javascript to catch the onClick and add a URL flag if someone came from your site.
If you were WebmasterWorld and have a lot of users who check the site quickly at the end of the day and right after turning on their computers (oh yes, you know who you are), you would also get a lot of "hits" that may not rerpesent what you want.
In the first case, you would also get a "hit" if two users were surfing from the same IP (as in a home network situation - "Hey Bob, look at this").