<?php
define('NTOP', 1);
$title = 'Статистика рейтинга';
require_once ('../system/connect.php');
require_once ('../system/core.php');
require_once ('../system/function.php');
require_once ('head.php');
	$plaforms_ban = mysql_num_rows(mysql_query("SELECT * FROM `".$prefix."sait` WHERE `ban` = '1'"));
	$sait_count = mysql_result(mysql_query("SELECT SUM(`count`) FROM `".$prefix."sait`;"), 0);
	$plaforms_moder = mysql_num_rows(mysql_query("SELECT * FROM `".$prefix."sait` WHERE `status` = '1' AND `hosts` > '0'"));
	$plaforms_all = mysql_num_rows(mysql_query("SELECT * FROM `".$prefix."sait`"));
	$users_all = mysql_num_rows(mysql_query("SELECT * FROM `".$prefix."users`"));
	$news_all = mysql_num_rows(mysql_query("SELECT * FROM `".$prefix."news`"));
	$cat_all = mysql_num_rows(mysql_query("SELECT * FROM `".$prefix."cat`"));
	$yday_start = mktime(0, 0, 0, date("m"), (date("d")-1), date("Y"));
	$yday_finish = mktime(23, 59, 59, date('m'), (date('d')-1), date('Y'));
	$day_start = mktime(0, 0, 0, date("m"), date("d"), date("Y"));
	$day_finish = mktime(23, 59, 59, date('m'), date('d'), date('Y'));
	$day_host = mysql_num_rows(mysql_query("SELECT * FROM `".$prefix."hosts` WHERE `time` BETWEEN '".$day_start."' AND '".$day_finish."'"));
	$day_hit = mysql_num_rows(mysql_query("SELECT * FROM `".$prefix."hits` WHERE `time` BETWEEN '".$day_start."' AND '".$day_finish."'"));
	$yday_host = mysql_num_rows(mysql_query("SELECT * FROM `".$prefix."hosts` WHERE `time` BETWEEN '".$yday_start."' AND '".$yday_finish."'"));
	$yday_hit = mysql_num_rows(mysql_query("SELECT * FROM `".$prefix."hits` WHERE `time` BETWEEN '".$yday_start."' AND '".$yday_finish."'"));
	$all_host = mysql_num_rows(mysql_query("SELECT * FROM `".$prefix."hosts`"));
	$all_hit = mysql_num_rows(mysql_query("SELECT * FROM `".$prefix."hits`"));
	$day_in = mysql_num_rows(mysql_query("SELECT * FROM `".$prefix."go` WHERE `time` BETWEEN '".$day_start."' AND '".$day_finish."' AND `type` = 'in'"));
	$day_out = mysql_num_rows(mysql_query("SELECT * FROM `".$prefix."go` WHERE `time` BETWEEN '".$day_start."' AND '".$day_finish."' AND `type` = 'out'"));
	$yday_in = mysql_num_rows(mysql_query("SELECT * FROM `".$prefix."go` WHERE `time` BETWEEN '".$yday_start."' AND '".$yday_finish."' AND `type` = 'in'"));
	$yday_out = mysql_num_rows(mysql_query("SELECT * FROM `".$prefix."go` WHERE `time` BETWEEN '".$yday_start."' AND '".$yday_finish."' AND `type` = 'out'"));
	$all_in = mysql_num_rows(mysql_query("SELECT * FROM `".$prefix."go` WHERE `type` = 'in'"));
	$all_out = mysql_num_rows(mysql_query("SELECT * FROM `".$prefix."go` WHERE `type` = 'out'"));
	$online = mysql_num_rows(mysql_query("SELECT * FROM `".$prefix."sait_online`"));
		echo '<div class="title2">Общее </div><div class="main">';
		echo 'Всего пользователей: <strong>'.$users_all.'</strong><br/>';
		echo 'Всего площадок: <strong>'.$plaforms_all.'</strong><br/>';
		echo 'Активированных сегодня: <strong>'.$plaforms_moder.'</strong><br/>';
		echo 'Заблокированных: <strong><a href="http://king-top.ru/m/ban">'.$plaforms_ban.'</a></strong><br/>';
		echo 'Всего категорий: <strong>'.$cat_all.'</strong><br/>';
		echo 'Всего просмотров: <strong>'.$sait_count.'</strong><br/>';
		echo 'Всего новостей: <strong>'.$news_all.'</strong><br/>';
                echo 'Сейчас на сайтах сидит: <strong>'.$online.'</strong> человек(а)</div>';
                echo '<div class="title2">Сегодня </div><div class="main">';
                echo 'Хостов: <strong>'.$day_host.'</strong><br/>';
		echo 'Хитов: <strong>'.$day_hit.'</strong><br/>';
                echo 'Пришло в топ: <strong>'.$day_in.'</strong><br/>';
		echo 'Ушло из топа: <strong>'.$day_out.'</strong></div>';
                echo '<div class="title2">Вчера </div><div class="main">';
                echo 'Хостов: <strong>'.$yday_host.'</strong><br/>';
		echo 'Хитов: <strong>'.$yday_hit.'</strong><br/>';
                echo 'Пришло в топ: <strong>'.$yday_in.'</strong><br/>';
		echo 'Ушло из топа: <strong>'.$yday_out.'</strong></div>';
                echo '<div class="title2">За весь период </div><div class="main">';
		echo 'Хостов: <strong>'.$all_host.'</strong><br/>';
		echo 'Хитов: <strong>'.$all_hit.'</strong><br/>';
		echo 'Пришло в топ: <strong>'.$all_in.'</strong><br/>';
		echo 'Ушло из топа: <strong>'.$all_out.'</strong></div>';

require_once ('foot.php');
?>