[wplug] Web logging?

Jonathan Billings billings at negate.org
Thu Nov 3 19:10:40 EST 2005


On Nov 3, 2005, at 2:43 PM, Zach wrote:
> I am making a website and the school hosting it allows me to run my  
> own CGI-BIN scripts. They have Perl 5 and PHP5 installed. and we  
> are allowed to run our own CGI-BIN scripts.  I would like a script  
> to log visitor info and to log it for historical purposes so I can  
> analyze it later on. The problem is I am totally new to the world  
> of Perl and PHP and was wondering if someone has an out-of-the-box  
> script I can use to learn from and then modify/extend as I learn. I  
> would like to log the following from each visitor:

Many of the following you can determine with a CGI by examining the  
server session variables in the script.
(here's the CGI.pm documentation)
http://search.cpan.org/src/LDS/CGI.pm-3.11/cgi_docs.html#environment

> Browser
> IP Address
> Timezone
> Hostname
> Platform (OS)
> Referrer

These, however, are not simply variables already set.  You'll  
probably have to store the information in a session table in a  
database that is keyed to the session.  Some of these, like  
resolution and color might be impossible to determine without having  
the browser execute code (java?).
>  Screen Size
>  Screen Resolution
>  Screen Color
>  Keyword
>  Country
>  Java Enabled/Disabled
>  JavaScript Enabled/Disabled
>  Entry Page
>  Exit Page
>  Relead yes/no



> I guess I could have it in a HTML page would be nice and once I  
> learn about SQL I can dump it into a database.
> But a flat file would be fine for now if you could help me with  
> that. Also my site has a main
> index.html page and many sub pages.

I like using the SQLite perl module to write SQL database interaction  
without having to deal with the overhead of running a full fledged  
SQL server.  It simply creates files, but you can still write all  
your DBI code.

> If someone comes to my site through a sub-page I figured their info  
> will not be logged so does that mean
> a copy of the script must be called for EVERY sub-page?

You'll need to monitor the path people travel through your website by  
monitoring the session.

--
Jonathan Billings <billings at negate.org>





More information about the wplug mailing list