Файл: CMS/core/modules/online.inc.php
Строк: 95
<?php
if (!defined('CMS')) { die('Access Denied!'); }
global $db, $log, $is_logged;
global $ip, $config;
$parse = parse_url($_SERVER['REQUEST_URI']);
if (substr(strrchr($parse['path'], '/'), -2) == '/?'):
$parse['path'] = str_replace('?', '', $parse['path']) . 'index.html?';
endif;
if (substr(strrchr($parse['path'], '/'), -1) == '/'):
$parse['path'] = $parse['path'] . 'index.html';
endif;
if (!defined('IS_ADMINKA') && !empty($config['allow_online'])) {
$db->query("DELETE FROM ?_users_online WHERE `online_time` < ?;", (SITE_TIME - $config['online_time']));
if ($is_logged) {
$is_user = (int) $db->selectCell("SELECT `online_id` FROM ?_users_online WHERE (`online_user` = ? OR `online_ip` = ?) LIMIT 1;", $log, $ip);
if ($is_user < 1) {
$db->query("INSERT INTO ?_users_online (`online_ip`, `online_brow`, `online_time`, `online_user`, `online_path`, `online_title`)
VALUES (?, ?, ?, ?, ?, ?);", $ip, $brow, SITE_TIME, $log, $parse['path'], $config['title']);
}
else {
$db->query("UPDATE ?_users_online SET `online_ip` = ?, `online_brow` = ?, `online_time` = ?, `online_user` = ?, `online_path` = ?, `online_title` = ? WHERE `online_id` = ? LIMIT 1;", $ip, $brow, SITE_TIME, $log, $parse['path'], $config['title'], $is_user);
}
}
else {
$is_user = (int) $db->selectCell("SELECT `online_id` FROM ?_users_online WHERE `online_ip` = ? LIMIT 1;", $ip);
if ($is_user < 1) {
$db->query("INSERT INTO ?_users_online (`online_ip`, `online_brow`, `online_time`, `online_path`, `online_title`)
VALUES (?, ?, ?, ?, ?);", $ip, $brow, SITE_TIME, $parse['path'], $config['title']);
}
else {
$db->query("UPDATE ?_users_online SET `online_brow` = ?, `online_time` = ?, `online_user` = ?, `online_path` = ?, `online_title` = ? WHERE `online_id` = ? LIMIT 1;", $brow, SITE_TIME, '', $parse['path'], $config['title'], $is_user);
}
}
}
?>