This is a multi-part message in MIME format.
------=_NextPart_000_0008_01C770B9.BD26B640
Content-Type: text/plain;
charset="iso-8859-7"
Content-Transfer-Encoding: quoted-printable
Anybody can tell me the full extend of Mattias Nilsson script?
I mean that I want to create log files that will contain ALL POSSIBLE =
information for every hit on a page (ex. user's ip, pages visited, time =
spend, entry and exit page, browser type and version, operating system, =
files accessed, type of files, if possible geographical and =
demographical data etc etc).
Is there something out there? Or is somebody experienced enough to show =
the code (sorry but I'm just an ignorant newbie).
Unless somebody can send me a better script to create log files. I need =
a script to create my own raw log file because I rent hosting from a =
server that does not give me the raw log data.
Regards
Gun Jah Man
gun [at] freemail.gr
p.s. Mattia's Script:
<?php
/*
* Common Logfile Format script.
*
* Author: Mattias Nilsson <mattias_at_coolt.nu>
*
*/
/* User definable variables */
$logfile =3D "clf.log"; /* Filename of log to write to */
$timezone =3D "+0100"; /* Timezone correction */
$lookup_size =3D true; /* Set to true to enable filesize lookup */
$document_root =3D "/usr/local/apache/share/htdocs";
/* A note about the lookup_size directive:
* This will make this script lookup the size of the original file on =
disk,
* which may or may not be the same amount of data sent to the client.
* It does give you a hint though..
* Oh, you have to set $document_root aswell if this should work..
*/
function write_to_log($str) {
if($fd =3D [at] fopen($GLOBALS[ "logfile"], "a")) {
fputs($fd, $str);
fclose($fd);
}
}
function get_var($name,$default) {
if($var =3D getenv($name)) {
return $var;
} else {
return $default;
}
}
if($remote_host =3D get_var( "REMOTE_HOST", true)) {
$remote_host =3D get_var( "REMOTE_ADDR", "-");
}
$remote_user =3D get_var( "REMOTE_USER", "-");
$remote_ident =3D get_var( "REMOTE_IDENT", "-");
$server_port =3D get_var( "SERVER_PORT", 80);
if($server_port!=3D80) {
$server_port =3D ":" . $server_port;
} else {
$server_port =3D "";
}
$server_name =3D get_var( "SERVER_NAME", "-");
$request_method =3D get_var( "REQUEST_METHOD", "GET");
$request_uri =3D get_var( "REQUEST_URI", "");
$user_agent =3D get_var( "HTTP_USER_AGENT", "");
if($lookup_size =3D=3D true && $document_root) {
$filename =3D ereg_replace( "\?.*", "", $request_uri);
$filename =3D "$document_root$filename";
if(!$size =3D filesize($filename)) {
$size =3D 0;
}
} else {
$size =3D 0;
}
$date =3D gmdate( "d/M/Y:H:i:s");
$log =3D "$remote_host $remote_ident $remote_user [$date $timezone] \"".
"$request_method http://$server_name$server_port$request_uri\" 200 =
$size\n";
write_to_log($log);
?>
------=_NextPart_000_0008_01C770B9.BD26B640
Content-Type: text/html;
charset="iso-8859-7"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-7">
<META content=3D"MSHTML 6.00.5730.11" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DTahoma size=3D2>Anybody can tell me the full extend of =
Mattias
Nilsson script? </FONT></DIV>
<DIV><FONT face=3DTahoma size=3D2>I mean that I want to create log files =
that will
contain ALL POSSIBLE information for every hit on a page (ex. user's ip, =
pages
visited, time spend, entry and exit page, browser type and version, =
operating
system, files accessed, type of files, if possible geographical and
demographical data etc etc). </FONT></DIV>
<DIV><FONT face=3DTahoma size=3D2>Is there something out there? Or is =
somebody
experienced enough to show the code (sorry but I'm just an ignorant =
newbie).
</FONT></DIV>
<DIV><FONT face=3DTahoma size=3D2></FONT> </DIV>
<DIV><FONT face=3DTahoma size=3D2>Unless somebody can send me a better =
script to
create log files. I need a script to create my own raw log file =
because I
rent hosting from a server that does not give me the raw log =
data.</FONT></DIV>
<DIV><FONT face=3DTahoma size=3D2><BR>Regards</FONT></DIV><FONT =
face=3DTahoma size=3D2>
<DIV><BR>Gun Jah Man<BR></FONT><A href=3D"mailto:gun [at] freemail.gr"><FONT
face=3DTahoma size=3D2>gun [at] freemail.gr</FONT></A></DIV>
<DIV><FONT face=3DTahoma size=3D2></FONT> </DIV>
<DIV><FONT face=3DTahoma size=3D2></FONT> </DIV>
<DIV><FONT face=3DTahoma size=3D2>p.s. Mattia's Script:</FONT></DIV>
<DIV><FONT face=3DTahoma size=3D2><BR><?php</DIV>
<DIV> </DIV>
<DIV>/*<BR>* Common Logfile Format script.<BR>*<BR>* Author: Mattias =
Nilsson
<mattias_at_coolt.nu><BR>*<BR>*/</DIV>
<DIV> </DIV>
<DIV>/* User definable variables */<BR>$logfile =3D
"clf.log"; /* Filename of log to write to =
*/<BR>$timezone
=3D "+0100"; /* Timezone correction
*/<BR>$lookup_size =3D true; /* Set to true to =
enable
filesize lookup */<BR>$document_root =3D
"/usr/local/apache/share/htdocs";</DIV>
<DIV> </DIV>
<DIV>/* A note about the lookup_size directive:<BR>* This will make this =
script
lookup the size of the original file on disk,<BR>* which may or may not =
be the
same amount of data sent to the client.<BR>* It does give you a hint
though..<BR>* Oh, you have to set $document_root aswell if this should
work..<BR>*/</DIV>
<DIV> </DIV>
<DIV>function write_to_log($str) {<BR> if($fd =3D
[at] fopen($GLOBALS[ "logfile"], "a")) {<BR> =
fputs($fd,
$str);<BR> fclose($fd);<BR> =
}<BR>}</DIV>
<DIV> </DIV>
<DIV>function get_var($name,$default) {<BR> if($var =
=3D
getenv($name)) {<BR> return =
$var;<BR> } else
{<BR> return $default;<BR> =
}<BR>}</DIV>
<DIV> </DIV>
<DIV>if($remote_host =3D get_var( "REMOTE_HOST", true)) =
{<BR>
$remote_host =3D get_var( "REMOTE_ADDR", =
"-");<BR>}<BR>$remote_user =3D
get_var( "REMOTE_USER", "-");<BR>$remote_ident =3D get_var(
"REMOTE_IDENT", "-");<BR>$server_port =3D get_var( "SERVER_PORT",
80);<BR>if($server_port!=3D80) {<BR> $server_port =
=3D ":" .
$server_port;<BR>} else {<BR> $server_port =3D
"";<BR>}<BR>$server_name =3D get_var( "SERVER_NAME",
"-");<BR>$request_method =3D get_var( "REQUEST_METHOD",
"GET");<BR>$request_uri =3D get_var( "REQUEST_URI", =
"");<BR>$user_agent =3D
get_var( "HTTP_USER_AGENT", "");<BR>if($lookup_size =3D=3D true =
&&
$document_root) {<BR> $filename =3D ereg_replace( =
"\?.*",
"", $request_uri);<BR> $filename =3D
"$document_root$filename";<BR> if(!$size =3D
filesize($filename)) {<BR> $size =3D =
0;<BR>
}<BR>} else {<BR> $size =3D 0;<BR>}</DIV>
<DIV> </DIV>
<DIV>$date =3D gmdate( "d/M/Y:H:i:s");<BR>$log =3D "$remote_host =
$remote_ident
$remote_user [$date $timezone] \"".<BR> =
"$request_method <A
href=3D"http://$server_name$server_port$request_uri\">http:/ /$server_name=
$server_port$request_uri\</A>"
200 $size\n";</DIV>
<DIV> </DIV>
<DIV>write_to_log($log);</DIV>
<DIV> </DIV>
<DIV>?></FONT></DIV>
<DIV><FONT face=3DTahoma size=3D2></FONT> </DIV>
<DIV><FONT face=3DTahoma size=3D2></FONT> </DIV></BODY></HTML>
------=_NextPart_000_0008_01C770B9.BD26B640--
