Tracking those bastards (the users i mean) is very common thing nowadays. So have made a simple and easy to use logger to track them.
There are few things which i need to tell you in order to use the LogManager class:
1. Download the arhive: LogManager.rar

2. Create two tables in your database with the following fileds. The tables are: sessions and actions

CREATE TABLE `sessions` (
`s__id` bigint(20) NOT NULL auto_increment,
`s__sess_id` varchar(255) collate latin1_general_ci NOT NULL,
`s__user` varchar(255) collate latin1_general_ci NOT NULL,
`s__type` varchar(255) collate latin1_general_ci NOT NULL,
`s__time_login` varchar(40) collate latin1_general_ci NOT NULL,
`s__time_logout` varchar(40) collate latin1_general_ci NOT NULL,
`s__date` varchar(40) collate latin1_general_ci NOT NULL,
PRIMARY KEY  (`s__id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=113 ;
CREATE TABLE `actions` (
`a__id` bigint(20) NOT NULL auto_increment,
`a__p_id` varchar(255) collate latin1_general_ci NOT NULL,
`a__time` varchar(40) collate latin1_general_ci NOT NULL,
`a__date` varchar(40) collate latin1_general_ci NOT NULL,
`a__type` varchar(20) collate latin1_general_ci NOT NULL,
`a__desc` text collate latin1_general_ci NOT NULL,
PRIMARY KEY  (`a__id`),
KEY `parent_id` (`a__p_id`),
FULLTEXT KEY `a__desc` (`a__desc`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=729 ;

3. Include the LogManager.php in your file (you can alter the path if necessary):

<?php
require_once('LogManager.php');
?>

4. Establish a connection to the database:

<?php
$connection = mysql_connect($host, $userdb, $passdb);
$db_connection =  mysql_select_db($db);
?>

5. Create an instance of the class:

<?php
//create the logger
$log = new LogManager(, );
?>

6. When entering the site through username and password:

<?php
//log entering the site to a definite session////////////////////////
$log->setSessTable("sessions");
$log->setDate();
$log->setTimeLogin();
//write into the database
$log->insertNewSession();
///////////////////////////////////////////////
?>

7. Loggin action. Place the code somewhere in your files. Wherever you want to log:

<?php
$log->setParentId(session_id());
$log->setActTable("actions");
$log->setActionTime();
$log->setActionType("login");//this type is defined by you
$log->setDescription("User has tryed to login");//the description is defined by you
$log->insertNewAction();//inserting the record into to database
?>

Saving to XML

1. Establish a connection to the database:

 

2. Call the file save_to_xml.php. It will create in logsystem/logfolder/ a xml file for the previous day called log_dd_mm_yyyy.xml and that’s all. The code below is already included in the file:

<?php
$yesterday = mktime(0,0,0,date("m"),date("d")-1,date("Y"));
$date = date("d-m-Y",$yesterday);
$file = "log_".$date.".xml";
$file = str_replace("-","_",$file);
$write_to_xml = new XMLShablon("logsystem/logfolder/".$file);
$date = strtotime($date);
$write_to_xml->writeToXML($date);
?>

NOTE:This file does not display anything only populates the xml file. So insert this file in for example Plesk scheduler to be called in 22.08.2008 00:01 and the file will create a xml file for 21.08.2008

Parsing the XML and exporting it into a result table

1. Call the file xml_parser/xml_to_table.php and it will generate a search form and a table of results
A field validators are also included for the date and the time

That is all folks. If there is a problem installing the logger please fill no worry to post me a comment.

Enjoy