469,282 Members | 1,732 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,282 developers. It's quick & easy.

browser.history and log file

Rg
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.

Jul 23 '05 #1
4 1858
Ivo
"Rg" wrote
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!


Client-side script can add to this, with info on screensizes and
colourdepths, by making up an image

"log.png?sw="+sreen.availWidth+etc.

where log.png is not only an image, but also runs a serverside logscript.
But if you 're only interested in your user's movements, you only need PHP
and no j(ava)script. The global $_SERVER array holds information on the
referrer. Just write

$_SERVER['HTTP_REFERER'] ---- $_SERVER['PHP_SELF']

to your logfile everytime a page is requested.
Ask in a PHP group for details.
Jul 23 '05 #2
Rg
"Ivo" <no@thank.you> wrote in
news:41**********************@news.wanadoo.nl:
"Rg" wrote
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!


Client-side script can add to this, with info on screensizes and
colourdepths, by making up an image

"log.png?sw="+sreen.availWidth+etc.

where log.png is not only an image, but also runs a serverside
logscript. But if you 're only interested in your user's movements,
you only need PHP and no j(ava)script. The global $_SERVER array holds
information on the referrer. Just write

$_SERVER['HTTP_REFERER'] ---- $_SERVER['PHP_SELF']

to your logfile everytime a page is requested.
Ask in a PHP group for details.


thank you to answer....
but you lost me (far away)
I will try php groups
Jul 23 '05 #3
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

Jul 23 '05 #4
Rg
Grant Wagner <gw*****@agricoreunited.com> wrote in news:411B9A25.68BE0853
@agricoreunited.com:
Subject: Re: browser.history and log file
From: Grant Wagner <gw*****@agricoreunited.com>
Newsgroups: comp.lang.javascript

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

Exactly what I needed.
I will remain a php student for a long long time
with so good tips :)
Thank you very much.
Rg.
Jul 23 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Michael G | last post: by
6 posts views Thread by David | last post: by
2 posts views Thread by | last post: by
8 posts views Thread by Ed Jay | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.