browser.history and log file

R

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

Ivo

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

Rg

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
 
G

Grant Wagner

Rg said:
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).
 
R

Rg

Subject: Re: browser.history and log file
From: Grant Wagner <[email protected]>
Newsgroups: comp.lang.javascript


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).
Exactly what I needed.
I will remain a php student for a long long time
with so good tips :)
Thank you very much.
Rg.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top