Source for file index.php
Documentation is available at index.php
require_once dirname(__FILE__ ) . '/include/version.php';
require_once dirname(__FILE__ ) . '/smarty/libs/Smarty.class.php';
require_once dirname(__FILE__ ) . '/lib/core.php';
die('Smarty must be installed for phpUserTrack to work. Try reinstalling if you have accidentally deleted it.');
$smarty->plugins_dir[] = 'include';
require_once $smarty->_get_plugin_filepath('function', 'html_doctype');
$login = new login(true);
$smarty->assign('login', $login);
header( 'Location: login.php' ) ;
define ("MOVING_AVERAGE_DAYS", 8); // number of days to use in the moving average calculation
if ($_GET['mode'] == 'delete') {
$sql = 'delete from phpusertrack_sites where id=' . $_GET['id'];
$del = $db->_query($sql);
$notify[] = array('title' => _('Site Deleted'),
'desc' => 'The site has been deleted from your list of installed and tracked sites.',
$sql = 'select (select count(*) from phpusertrack_data as tmpdata where tmpdata.site_id=phpusertrack_sites.id) as count, phpusertrack_sites.* from phpusertrack_sites group by id';
$sites = $db->_query($sql);
$smarty->assign('sitesold', $_SESSION['sitesold']);
$_SESSION['sitesold'] = $sites;
$sql = 'select browser, count(id)*100/(select count(*) from phpusertrack_ip) as percent from phpusertrack_ip group by browser order by percent desc limit 10';
$avgs = $db->_query($sql);
$sql = "Select Count(phpusertrack_data.path) AS `count`, phpusertrack_data.path, phpusertrack_sites.url, phpusertrack_data.site_id From phpusertrack_data Inner Join phpusertrack_sites ON phpusertrack_data.site_id = phpusertrack_sites.id Group By phpusertrack_data.path, phpusertrack_sites.id Order By `count` Desc Limit 10";
$paths = $db->_query($sql);
$sql = "select count(id) as count, ip from phpusertrack_ip group by ip order by count desc limit 10";
$sessions = $db->_query($sql);
$notify[] = array('title' => 'Database Error',
'desc' => $e->getMessage(),
$smarty->assign('mysqlQueryTime', (getmicrotime() - $time));
$smarty->assign('sites', $sites);
$smarty->assign('browseravgs', $avgs);
$smarty->assign('paths', $paths);
$smarty->assign('sessions', $sessions);
$smarty->assign('mysqlHost', $conf['mysqlHost']);
$smarty->assign('mysqlPort', $conf['mysqlPort']);
$smarty->assign('mysqlDb', $conf['mysqlDbName']);
$smarty->assign('notifMsg', $notify);
$smarty->display('header.tpl');
$smarty->display('index.tpl');
$smarty->assign('pageRenderTime', (getmicrotime() - $time));
$smarty->display('footer.tpl');
|