forked from benyafai/TinyAnalytics
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtracker.php
More file actions
18 lines (17 loc) · 692 Bytes
/
tracker.php
File metadata and controls
18 lines (17 loc) · 692 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
function summarize($force = false)
{
$lastsummarize = realpath(dirname(__FILE__)) . '/.lastsummarize';
if (!file_exists($lastsummarize) || ((time() - file_get_contents($lastsummarize)) > 3600) || $force) {
include_once(realpath(dirname(__FILE__)) . '/summarize.php');
return true;
} else
return false;
}
function record_visit($sitename, $ref)
{
$logfile = realpath(dirname(__FILE__)) . '/logs/' . $sitename . '.log';
$txt = time() . "\t" . $_SERVER['REMOTE_ADDR'] . "\t" . $ref . "\t" . (isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '') . PHP_EOL;
file_put_contents($logfile, $txt, FILE_APPEND);
summarize();
}