Re: Logging Referer

From: Date: Sat, 22 Feb 2003 04:19:49 +0000
Subject: Re: Logging Referer
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-136594@lists.php.net to get a copy of this message
Hi, Saturday, February 22, 2003, 9:19:13 AM, you wrote: MH> Hi all, MH> I'm working on adding some logging functionality to a PHP image counter MH> script that I wrote. The counter outputs an image representing the current MH> number of hits and is used via an <img> tag. After it displays the image, MH> the counter collects information about the user (browser version and OS, MH> date and time of visit, ip, etc). I'd also like for it to log the referer, MH> but because the counter is triggered via an <img> tag, the referer is always MH> the page that has the <img> tag. Is there any other way to grab the referer MH> that actually sent the user to the page that contains the counter? I'd like MH> for the counter to work even when included in static HTML pages, so the MH> including page cannot use any PHP to help facilitate this logging MH> functionality. MH> I hope all that makes sense. MH> Anyone have any suggestions on how to achieve what I'm after? MH> ---Matt Probably the only way is with javascript..I did this a while back (php v2 :) <!-- Start of Counter Code --> <SCRIPT><!-- NS2=0 f=""+escape(document.referrer) if (f == ""){f="unknown"} function prnt(n) {document.write(n,"\n");} if (navigator.appName == "Netscape" && navigator.appVersion.charAt(0) == "2") {NS2=1} if (NS2 == 0) {r=f+"+9";prnt("<IMG BORDER=0 SRC=\"http://domain.com.au/stats/invisman.phtml?"+r+"\">")} //--></SCRIPT> <NOSCRIPT> <IMG SRC="http://domain.com.au/stats/invisman.phtml?unknown+9" BORDER=0></A> </NOSCRIPT> <!-- End of Counter Code --> (the +9 was a page id, invisman.phtml returned a transparent gif) -- regards, Tom

« previous php.general (#136594) next »