Yeah, I had thought about using JavaScript.  I had hoped that there was
another way, but if there is, I can't figure it out.

---Matt

-----Original Message-----
From: Justin French [mailto:[EMAIL PROTECTED] 
Sent: Friday, February 21, 2003 8:37 PM
To: Matt Honeycutt; Php-General
Subject: Re: [PHP] Logging Referer

on 22/02/03 10:19 AM, Matt Honeycutt ([EMAIL PROTECTED]) wrote:

> I'd also like for it to log the referer,
> but because the counter is triggered via an <img> tag, the referer is
always
> the page that has the <img> tag.  Is there any other way to grab the
referer
> that actually sent the user to the page that contains the counter?
I'd like
> for the counter to work even when included in static HTML pages, so
the
> including page cannot use any PHP to help facilitate this logging
> functionality.

No, not easily :)

On PHP pages, you could get the referrer, and append it to the URL,
forcing
the "correct" REFERRER through to the img script:

<img src="makeMyCounter.php?ref=<?=$_SERVER['HTTP_REFERRER']?>">

And you *could* choose to force .html files through the PHP parser, so
foo.html could use the above code.


I think the other alternative is to use javascript to build the img tag,
because I'm pretty sure JS can figure out the referrer.

But this has the obvious downside of JS being NO WHERE NEAR guaranteed
to be
on each browser.


I think i'm missing something though, because I *think* those free
counter/stat programs DO log a referrer... wait -- just checked
thecounter.com, and they DO use JS for the referrer.


Justin





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to