php-general | 2003022
Date: 02/21/03
- Next message: Philip Olson: "Re: [PHP] "Constants" for dummies, please?"
- Previous message: David T-G: "Re: [PHP] Array instead of Switch"
- In reply to: Matt Honeycutt: "[PHP] Logging Referer"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
- Next message: Philip Olson: "Re: [PHP] "Constants" for dummies, please?"
- Previous message: David T-G: "Re: [PHP] Array instead of Switch"
- In reply to: Matt Honeycutt: "[PHP] Logging Referer"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

