Source for file core.php
Documentation is available at core.php
* The core componant of phpUserTrack. This brings all the libraries together.
* @author Christopher Troup <mini@chatetheory.com>
require_once 'libExceptions.php';
* Gets the system time in high resolution
* @return int System Time
return ((float) $usec + (float) $sec);
header('P3P: CP="CAO PSA OUR"');
require_once 'liblogin.php';
* Include useragent detection library.
require_once 'libdetectuseragent.php'; // Browser detection alogorithm
* Include database access functions.
require_once 'libsite.php';
require_once 'libdata.php';
require_once 'libip.php';
* Include the plugin architecture.
require_once 'libplugins.php';
* Include the configuration file.
if (!@include_once (dirname(__FILE__ ) . '/../conf/conf.php')) {
header( 'Location: install.php' ) ;
putenv("TZ=" . $conf['timezone']);
* Check to see if they have GeoIP installed. If they do record the fact for future use.
if (@include_once 'Net/GeoIP.php') {
$geoIP = file_exists(dirname(__FILE__ ) . '/../include/GeoLiteCity.dat');
if (@include_once 'Cache/Lite.php') {
$plugins = new plugins(); // create a new instance of the plugin class
* Preform the tracking of the user who requested the page.
* @global plugins $plugins
function phpUserTrack($site_id = null, $path = null, $refferrer = null) {
$ip = $_SERVER['REMOTE_ADDR'];
foreach ($plugins->hooks['ip.pre'] as $obj) {
$ipCon = $obj->invoke($ipCon);
$path = $_SERVER['REQUEST_URI'];
if ($ipCon->getProfileId() == null) {
$browserArray = $agent->getBrowserArray();
$ipCon->insertProfile($browserArray['browser'],
$browserArray['version'],
$browserArray['platform']);
foreach ($plugins->hooks['ip.post'] as $obj) {
$ipCon = $obj->invoke($ip);
//$sql = 'select id from phpusertrack_sites where id like %' . $_GET['server'];
//$site_id = $db->_query($sql);
//$site_id = $site_id[0];
$dataCon = new phpusertrack_data($site_id, $ipCon->getProfileId(), $path, $_SERVER['HTTP_REFERER']);
foreach ($plugins->hooks['data.pre'] as $obj) {
$dataCon = $obj->invoke($dataCon);
$dataCon->insertNewPageHit();
foreach ($plugins->hooks['data.post'] as $obj) {
$dataCon = $obj->invoke($dataCon);
|