<?php
#-----------------------------------------------------#
# ********* ROTORCMS ********* #
# Made by : VANTUZ #
# E-mail : [email protected] #
# Site : http://pizdec.ru #
# WAP-Site : http://visavi.net #
# ICQ : 36-44-66 #
# Вы не имеете право вносить изменения в код скрипта #
# для его дальнейшего распространения #
#-----------------------------------------------------#
require_once "../includes/start.php";
require_once "../includes/functions.php";
require_once "../includes/header.php";
include_once "../themes/" . $config['themes'] . "/index.php";
$currhour = date("G", SITETIME);
$currday = date("j", SITETIME);
if (isset($_GET['act'])) {
$act = check($_GET['act']);
} else {
$act = 'index';
}
switch ($act):
# ###########################################################################################
# # Вывод статистики ##
# ###########################################################################################
case 'index':
echo '<img src="../images/img/site.png" alt="image" /> <b>Количество посещений</b><br /><br />';
$online = stats_online();
$count = stats_counter();
echo 'Всего посетителей на сайте: <b>' . $online[1] . '</b><br />';
echo 'Всего авторизованных: <b>' . $online[0] . '</b><br />';
echo 'Всего гостей: <b>' . ($online[1] - $online[0]) . '</b><br /><br />';
echo 'Хостов сегодня: <b>' . $count['count_dayhosts'] . '</b><br />';
echo 'Хитов сегодня: <b>' . $count['count_dayhits'] . '</b><br />';
echo 'Всего хостов: <b>' . $count['count_allhosts'] . '</b><br />';
echo 'Всего хитов: <b>' . $count['count_allhits'] . '</b><br /><br />';
echo 'Хостов за текущий час: <b>' . $count['count_hosts24'] . '</b><br />';
echo 'Хитов за текущий час: <b>' . $count['count_hits24'] . '</b><br /><br />';
$query24 = DB :: $dbh -> query("SELECT SUM(`count_hosts`) AS `hosts`, SUM(`count_hits`) AS `hits` FROM `counter24`;");
$counts24 = $query24 -> fetch();
echo 'Хостов за 24 часа: <b>' . ($counts24['hosts'] + $count['count_hosts24']) . '</b><br />';
echo 'Хитов за 24 часа: <b>' . ($counts24['hits'] + $count['count_hits24']) . '</b><br /><br />';
$query31 = DB :: $dbh -> query("SELECT SUM(`count_hosts`) AS `hosts`, SUM(`count_hits`) AS `hits` FROM `counter31`;");
$counts31 = $query31 -> fetch();
echo 'Хостов за месяц: <b>' . ($counts31['hosts'] + $count['count_dayhosts']) . '</b><br />';
echo 'Хитов за месяц: <b>' . ($counts31['hits'] + $count['count_dayhits']) . '</b><br /><br />';
echo 'Динамика за сутки<br />';
echo '<img src="' . BASEDIR . 'gallery/count24.php" alt="image" /><br /><br />';
echo 'Динамика за месяц<br />';
echo '<img src="' . BASEDIR . 'gallery/count31.php" alt="image" /><br /><br />';
echo '<a href="counter.php?act=count24&' . SID . '">Статистика по часам</a><br />';
echo '<a href="counter.php?act=count31&' . SID . '">Статистика по дням </a><br /><br />';
break;
# ###########################################################################################
# # Статистика за 24 часа ##
# ###########################################################################################
case 'count24':
echo '<img src="../images/img/site.png" alt="image" /> <b>Статистика по часам</b><br /><br />';
echo 'Динамика за сутки<br />';
echo '<img src="' . BASEDIR . 'gallery/count24.php" alt="image" /><br /><br />';
if ($currhour > 0) {
$hours = floor((gmmktime(date("H"), 0, 0, date("m"), date("d"), date("Y")) - gmmktime(4, 0, 0, 1, 1, 1970)) / 3600);
$querycount = DB :: $dbh -> query("SELECT * FROM `counter24` ORDER BY `count_hour` DESC;");
$counts = $querycount -> fetchAll();
$arrhits = array();
$arrhosts = array();
$hits_data = array();
$host_data = array();
foreach ($counts as $val) {
$arrhits[$val['count_hour']] = $val['count_hits'];
$arrhosts[$val['count_hour']] = $val['count_hosts'];
}
for ($i = 0, $tekhours = $hours; $i < 24; $tekhours -= 1, $i++) {
if (isset($arrhits[$tekhours])) {
$hits_data[$tekhours] = $arrhits[$tekhours];
} else {
$hits_data[$tekhours] = 0;
}
if (isset($arrhosts[$tekhours])) {
$host_data[$tekhours] = $arrhosts[$tekhours];
} else {
$host_data[$tekhours] = 0;
}
}
$hits_data = array_reverse($hits_data, true);
$host_data = array_reverse($host_data, true);
echo '<b>Время — Хосты / Хиты</b><br />';
for ($i = 0, $tekhours = $hours; $i < $currhour; $tekhours -= 1, $i++) {
echo date_fixed(floor(($tekhours-1) * 3600), 'H:i') . ' - ' . date_fixed(floor($tekhours * 3600), 'H:i') . ' — <b>' . $host_data[$tekhours] . '</b> / <b>' . $hits_data[$tekhours] . '</b><br />';
}
echo '<br />';
} else {
show_error('Статистика за текущие сутки еще не обновилась!');
}
echo '<img src="../images/img/back.gif" alt="image" /> <a href="counter.php?' . SID . '">Вернуться</a><br />';
break;
# ###########################################################################################
# # Статистика за месяц ##
# ###########################################################################################
case 'count31':
echo '<img src="../images/img/site.png" alt="image" /> <b>Статистика по дням</b><br /><br />';
echo 'Динамика за месяц<br />';
echo '<img src="' . BASEDIR . 'gallery/count31.php" alt="image" /><br /><br />';
if ($currday > 1) {
$days = floor((gmmktime(0, 0, 0, date("m"), date("d"), date("Y")) - gmmktime(0, 0, 0, 1, 1, 1970)) / 86400);
$querycount = DB :: $dbh -> query("SELECT * FROM `counter31` ORDER BY `count_days` DESC;");
$counts = $querycount -> fetchAll();
$arrhits = array();
$arrhosts = array();
$hits_data = array();
$host_data = array();
foreach ($counts as $val) {
$arrhits[$val['count_days']] = $val['count_hits'];
$arrhosts[$val['count_days']] = $val['count_hosts'];
}
for ($i = 0, $tekdays = $days; $i < 31; $tekdays -= 1, $i++) {
if (isset($arrhits[$tekdays])) {
$hits_data[$tekdays] = $arrhits[$tekdays];
} else {
$hits_data[$tekdays] = 0;
}
if (isset($arrhosts[$tekdays])) {
$host_data[$tekdays] = $arrhosts[$tekdays];
} else {
$host_data[$tekdays] = 0;
}
}
$hits_data = array_reverse($hits_data, true);
$host_data = array_reverse($host_data, true);
echo '<b>Дата — Хосты / Хиты</b><br />';
for ($i = 1, $tekdays = $days; $i < $currday; $tekdays -= 1, $i++) {
echo date_fixed(floor(($tekdays-1) * 86400), 'd.m') . ' - ' . date_fixed(floor($tekdays * 86400), 'd.m') . ' — <b>' . $host_data[$tekdays] . '</b> / <b>' . $hits_data[$tekdays] . '</b><br />';
}
echo '<br />';
} else {
show_error('Статистика за текущий месяц еще не обновилась!');
}
echo '<img src="../images/img/back.gif" alt="image" /> <a href="counter.php?' . SID . '">Вернуться</a><br />';
break;
default:
header("location: counter.php?" . SID);
exit;
endswitch;
echo '<img src="../images/img/homepage.gif" alt="image" /> <a href="../index.php?' . SID . '">На главную</a><br />';
include_once"../themes/" . $config['themes'] . "/foot.php";
?>