<?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'"));
	$plaforms_akt = mysql_num_rows(mysql_query("SELECT * FROM `".$prefix."sait` WHERE `status` = '1' AND `ban` = '0' AND `hosts` > '0'"));
	$plaforms_all = mysql_num_rows(mysql_query("SELECT * FROM `".$prefix."sait`"));
	$user = mysql_num_rows(mysql_query("SELECT * FROM `".$prefix."users`"));
        $plaforms_moder = mysql_num_rows(mysql_query("SELECT * FROM `".$prefix."sait` WHERE `status` = '0' AND `ban` = '0'"));
	$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."'"));
	$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'"));
	$online = mysql_num_rows(mysql_query("SELECT * FROM `".$prefix."sait_online`"));
		echo '<div class="top"><div class="title2"><font color="#fff">Общее</font></div><div class="clear"></div></div><div class="main">';
		echo 'Всего пользователей: <strong>'.$user.'</strong><br/>';
		echo 'Всего площадок: <strong>'.$plaforms_all.'</strong><br/>';
		echo 'Активных сегодня: <strong>'.$plaforms_akt.'</strong><br/>';
		echo 'На модерации: <strong>'.$plaforms_moder.'</strong><br/>';
		echo 'Заблокированных: <strong><a href="http://'.$set['home'].'/m/ban">'.$plaforms_ban.'</a></strong><br/>';
		echo 'Всего категорий: <strong>'.$cat_all.'</strong><br/>';
		echo 'Всего новостей: <strong>'.$news_all.'</strong><br/>';
                echo 'Сейчас на сайтах сидит: <strong>'.$online.'</strong> человек(а)</div>';
                echo '<div class="top"><div class="title2"><font color="#fff">Сегодня </font></div><div class="clear"></div></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="top"><div class="title2"><font color="#fff">Вчера </font></div><div class="clear"></div></div><div class="main">';
                echo 'Хостов: <strong>'.@mysql_result(mysql_query("SELECT SUM(`of_hosts`) FROM `".$prefix."sait`"),0).'</strong><br/>';
                echo 'Хитов: <strong>'.@mysql_result(mysql_query("SELECT SUM(`of_hits`) FROM `".$prefix."sait`"),0).'</strong><br/>';
                echo 'В топ: <strong>'.@mysql_result(mysql_query("SELECT SUM(`of_in`) FROM `".$prefix."sait`"),0).'</strong><br/>';
                echo 'Из топа: <strong>'.@mysql_result(mysql_query("SELECT SUM(`of_out`) FROM `".$prefix."sait`"),0).'</strong></div>';
                echo '<div class="top"><div class="title2"><font color="#fff">Всего </font></div><div class="clear"></div></div><div class="main">';
                echo 'Хостов: <strong>'.@mysql_result(mysql_query("SELECT SUM(`all_hosts`) FROM `".$prefix."sait`"),0).'</strong><br/>';
                echo 'Хитов: <strong>'.@mysql_result(mysql_query("SELECT SUM(`all_hits`) FROM `".$prefix."sait`"),0).'</strong><br/>';
                echo 'В топ: <strong>'.@mysql_result(mysql_query("SELECT SUM(`all_in`) FROM `".$prefix."sait`"),0).'</strong><br/>';
                echo 'Из топа: <strong>'.@mysql_result(mysql_query("SELECT SUM(`all_out`) FROM `".$prefix."sait`"),0).'</strong></div>';
require_once ('foot.php');
?>