in reply to Re: $ENV{'HTTP_REFERRER'} and images
in thread $ENV{'HTTP_REFERRER'} and images

Yes that is what happends but I want the referrer to be the http://www.site.com, not the http://www.domain.com which is where the script is called from. Basically this is all thats left for me to finnish a access logging script. Which will store the referrers to a page using an image tag.

Replies are listed 'Best First'.
Re^3: $ENV{'HTTP_REFERRER'} and images
by shemp (Deacon) on Jun 10, 2004 at 21:52 UTC
    I think that the thing you're missing here is that you cant create your own definition of HTTP_REFERRER and expect it to work.

    As i said earlier, when you serve up the page at www.domain.com, you'll have to store its referrer somewhere to access later and use in the script that runs when the image is clicked.
Re^3: $ENV{'HTTP_REFERRER'} and images
by hsinclai (Deacon) on Jun 10, 2004 at 21:53 UTC
    HTTP_REFERRER is a client side constructed entity, IIRC. Not all browsers send it, and none are required to as I understand. It is trivially spoofed, and shouldn't be counted on too heavily.

    Why don't you let the image reside (and be fetched from) the server you want?



Re^3: $ENV{'HTTP_REFERRER'} and images
by eXile (Priest) on Jun 11, 2004 at 00:20 UTC

    Your webserver logs (if properly configured) will give you all the information you need (al the warnings about fake-referer headers still apply of course). With some scripting you'll even find the grandparent-referers if thats what you are after.

    For instance if you look at this apache access log (I've modified the content, so might contain typo's):

    1.1.1.1 - - [10/Jun/2004:14:50:41 -0700] "GET /index.html HTTP/1.1" 20 +0 808 "http://www.othersite.com/" "Mozilla/4.0 (compatible; MSIE 6.0; + Windows NT 5.1; FunWebProducts)" 1.1.1.1 - - [10/Jun/2004:14:50:51 -0700] "GET /index2.html HTTP/1.1" 2 +00 1200 "http://www.mysite.com/index.html" "Mozilla/4.0 (compatible; +MSIE 6.0; Windows NT 5.1; FunWebProducts)" 1.1.1.1 - - [10/Jun/2004:14:50:51 -0700] "GET /logo.png HTTP/1.1" 200 +15000 "http://www.mysite.com/index2.html" "Mozilla/4.0 (compatible; M +SIE 6.0; Windows NT 5.1; FunWebProducts)"
    You can see somebody came from www.othersite.com to www.mysite.com/index.html and after 10 seconds he loaded index2.html which contains logo.png. If you can't get this information from the logging provided I suggest you read the Apache documentation on their logging formats.

    Why do you need a picture-referer-thingie for that?