Rg wrote:
Hello,
I am very beginner with jscript. I have an Apache PHP enabled
webserver and want to know from where users are coming from.
Understand I want the last surfer's browser visited url.
I imagine I can do this with some kind of interraction
between 2 scripts : one client side, one server side.
The client one send the URL and the server one write it
in the right log file.
I have no idea of how to do this ... Can somebody help?
Any idea appreciated!
Thanks
Rg.
Properly configured, apache will record the referer for you:
LogFormat "%{Referer}i -> %U" referer
CustomLog /var/log/referer_log referer
or
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\"
\"%{User-Agent}i\"" combined
CustomLog /var/log/httpd-access.log combined
In fact, the latter is the way apache comes "out of the box" I
believe. In other words, httpd-access.log should contain a record
of the referer for each request. Personally I use:
LogFormat "%h %l %u %t \"%!414r\" %>s %b \"%{Referer}i\"
\"%{User-Agent}i\"" combined
SetEnvIf Request_Method ^SEARCH donotlog
CustomLog /var/log/httpd-access.log combined env=!donotlog
Because I want to exclude those 8KB SEARCH requests made by
infected IIS machines.
Writing something in PHP to retrieve the log information and
present it in a meaningful way is left as an exercise for the
student (I'm sure there's plenty of free and open source
solutions out there to do this as well).
--
Grant Wagner <gw*****@agricoreunited.com>
comp.lang.javascript FAQ -
http://jibbering.com/faq