<?php
$type = 'file';
//$type = 'db';
// determine the tracker type
if ($type == 'file') {
require_once 'IPTrackerFile.php';
$tracker = new IPTrackerFile('ip.log');
} else {
require_once 'IPTrackerDB.php';
require_once '../anyDB/anyDB.php';
$db = anyDB::getLayer('MYSQL', '', 'mysql');
$tracker = new IPTrackerDB($db, 'localhost', 'php', '', '');
}
// the tracker type
echo $tracker->getIdentifier() . '<p>';
// track the current visitor
$tracker->track();
// status data
echo 'my ip: ' . $tracker->getIP() . '<br>';
echo 'entries : ' . $tracker->count . '<p>';
// get the last entry
$last = $tracker->get($tracker->count);
echo 'latest entry:<br>';
echo date('Y-m-d H.i.s', $last['time']) . ' | ' . $last['ip'] . ' | ' . $last['host'] . ' | ' .$last['referer'];
?>
|