if (!defined('BASEDIR')) {
header('Location:../index.php');
exit;
}
$days = floor((gmmktime(0, 0, 0, date("m"), date("d"), date("Y")) - gmmktime(0, 0, 0, 1, 1, 1970)) / 86400);
$hours = floor((gmmktime(date("H"), 0, 0, date("m"), date("d"), date("Y")) - gmmktime(4, 0, 0, 1, 1, 1970)) / 3600);
DB :: $dbh -> query("DELETE FROM `online` WHERE `online_time`<?;", array(SITETIME-600));
$newhost = 0;
if (is_user()) {
$queryonline = DB :: $dbh -> querySingle("SELECT `online_id` FROM `online` WHERE `online_ip`=? OR `online_user`=? LIMIT 1;", array($ip, $log));
if (empty($queryonline)) {
DB :: $dbh -> query("INSERT INTO `online` (`online_ip`, `online_brow`, `online_time`, `online_user`) VALUES (?, ?, ?, ?);", array($ip, $brow, SITETIME, $log));
$newhost = 1;
} else {
DB :: $dbh -> query("UPDATE `online` SET `online_ip`=?, `online_brow`=?, `online_time`=?, `online_user`=? WHERE `online_id`=? LIMIT 1;", array($ip, $brow, SITETIME, $log, $queryonline));