<?php
if (!defined('NTLCMS')) die('<center><b>Restricted access</b></center>');
$useronline = DB::run()->querySingle("select count(`id`) from `users` where `login` <> '' and `ontime` > ?", array(TIME - 180));
$guestonline = DB::run()->querySingle("select count(`id`) from `session`");
$desc = DB::run()->query("select `login`, `sex` from `users` where `active` = '1' order by `id` desc limit 1")->fetch(PDO::FETCH_OBJ);
$maximum = DB::run()->querySingle("select `max` from `maxonline` where `id` = 1");
if ($useronline > $maximum) {
DB::run()->query("update `maxonline` set `max` = `max` + 1, `date` = '" . TIME . "' where `id` = 1");
}
$max = DB::run()->querySingle("select `guest` from `maxonline` where `id` = 1");
if ($guestonline > $max) {
DB::run()->query("update `maxonline` set `guest` = `guest` + 1, `gdate` = '" . TIME . "' where `id` = 1");
}
echo '<div class="foot"><left>';
echo '&raquo; Онлайн: <a href="' . URL . '/online">' . USERS_ONLINE() . '</a>  + ' . word(GUEST_ONLINE(), 'гость', 'гостя', 'гостей') . '<br/>';
if ($_USER['admin'] == '1' && $desc && $desc->login) {
echo '&raquo; Последн' . ($desc->sex == '1' ? 'ий' : 'яя') . ': ' . login($desc->login) . '<br/>';
}
if ($_USER['admin'] == '1') echo '&raquo; MySQL запросов: ' . DB::run()->queryCounter() . '<br/>';
if ($_USER['admin'] == '1') echo '&raquo; Ген: ' . round(microtime(1) - GENERATE, 4) . ' сек<br/>';
echo '</left></div>';
$count_array = DB::run()->query("select * from `count_day` where `date` = '" . date('d.m.Y') . "' limit 1")->fetch(PDO::FETCH_OBJ);
echo '<div style="text-align: center; color: #000000;"><small>Хосты: ' . ((int) $count_array->host) . ' | Хиты: ' . ((int) $count_array->hit) . '</small>';
echo '<center>&copy; 2025' . (date('Y') > 2025 ? '-' . date('Y') : '') . ' ' . checkout($set['copy']) . '</center>';
echo '</div></div></div>';
echo '<script type="text/javascript" src="' . URL . '/style/js/jquery.js"></script>';
echo '<script type="text/javascript" src="' . URL . '/style/js/bootstrap.min.js"></script>';
echo '<script type="text/javascript" src="' . URL . '/style/js/main.js"></script>';
echo '</body></html>';
?>
<script>
function updateLiveTime() {
var now = new Date();
var hours = now.getHours().toString().padStart(2, "0");
var minutes = now.getMinutes().toString().padStart(2, "0");
var seconds = now.getSeconds().toString().padStart(2, "0");
var day = now.getDate().toString().padStart(2, "0");
var month = (now.getMonth() + 1).toString().padStart(2, "0");
var year = now.getFullYear().toString().slice(-2);
var colonVisible = now.getSeconds() % 2 === 0;
var colon = colonVisible ? ":" : " ";
var timeString = "Время: " + hours + colon + minutes + ":" + seconds + 
" <br> Дата: " + day + "." + month + "." + year;
document.getElementById("liveTime").innerHTML = timeString;
}
updateLiveTime();
setInterval(updateLiveTime, 1000);
</script>