<?php
#-----------------------------------------------------#
# Зц Sea mod Ganjara                                  #
# 	 Автор : Slayer  with   Ganjar                    #
#    ICQ :   566003         993770                    #
#    Вы не имеете права распространять данный скрипт. #
# 		По всем вопросам пишите в ICQ.                  #
#-----------------------------------------------------#

define('_IN_JOHNCMS', 1);
$zc=1;
$headmod = 'load';
$textl = 'Настройки пользователя';
require_once ("../incfiles/core.php");
require_once ("../incfiles/head.php");
$time = time();
$setting = mysql_query('SELECT * FROM `zc_setting`;');

while($set = mysql_fetch_assoc($setting)){
$setup[$set['name']] = $set['value'];
}

$hackmess = $setup['hackmess'];

require 'moduls/ini.php';
require 'moduls/fun.php';
###############Если статистика выключена###############
if($setup['stat_change'] == 0) die('Not found');
#######################################################

$all_size = mysql_fetch_row(mysql_query('SELECT SUM(`size`) FROM `'.$setup['pref'].'files` WHERE `size` > 0 AND `open`=0'));

if($all_size[0] < 1048576){
$all_size[0] = round($all_size[0]/1024, 2).'Kb';
}
else{
$all_size[0] = round($all_size[0]/1024/1024, 2).'Mb';
}

$all_files = mysql_fetch_row(mysql_query('SELECT COUNT(*) FROM `'.$setup['pref'].'files` WHERE `size` > 0 AND `open`=0'));
$all_loads = mysql_fetch_row(mysql_query('SELECT SUM(`loads`) FROM `'.$setup['pref'].'files` WHERE `size` > 0 AND `open`=0'));
$new_all_files = mysql_fetch_row(mysql_query('SELECT COUNT(*) FROM `'.$setup['pref'].'files` WHERE `timeupload` > '.($time-(86400*$setup['day_new'])).' AND `size` > 0 AND `open`=0'));

$max_online = mysql_fetch_row(mysql_query('SELECT `time` FROM `'.$setup['pref'].'online` WHERE `id` = 1'));

echo '<div class="phdr">Статистика ЗЦ:</div>
<div class="gmenu">
Всего файлов: '.(int)$all_files[0].'<br/>
Всего новых файлов: '.(int)$new_all_files[0].'<br/>
Общий объем: '.$all_size[0].'<br/>
Всего скачиваний: '.(int)$all_loads[0].'<br/>
Максимум онлайн: '.(int)$max_online[0].'<br/>
</div>';



$all_size = mysql_fetch_row(mysql_query('SELECT SUM(`size`) FROM `'.$setup['pref'].'files` WHERE `size` > 0  AND `open`=1'));

if($all_size[0] < 1048576){
$all_size[0] = round($all_size[0]/1024, 2).'Kb';
}
else{
$all_size[0] = round($all_size[0]/1024/1024, 2).'Mb';
}

$all_files = mysql_fetch_row(mysql_query('SELECT COUNT(*) FROM `'.$setup['pref'].'files` WHERE `size` > 0  AND `open`=1'));
$all_loads = mysql_fetch_row(mysql_query('SELECT SUM(`loads`) FROM `'.$setup['pref'].'files` WHERE `size` > 0 AND `open`=1'));
$new_all_files = mysql_fetch_row(mysql_query('SELECT COUNT(*) FROM `'.$setup['pref'].'files` WHERE `timeupload` > '.($time-(86400*$setup['day_new'])).' AND `size` > 0 AND `open`=1'));


echo '<div class="phdr">Статистика Обменника:</div>
<div class="gmenu">
Всего файлов: '.(int)$all_files[0].'<br/>
Всего новых файлов: '.(int)$new_all_files[0].'<br/>
Общий объем: '.$all_size[0].'<br/>
Всего скачиваний: '.(int)$all_loads[0].'<br/>
</div>';
echo '<div class="bmenu">';
//------------------------------------------------------------------------------------------
echo '<li><a href="index.php'.($_GET['open']==1 ? '?open=1':'').'">Загрузки</a></li>
<li><a href="'.$setup['site_url'].'">На главную</a></li>
';
echo '</div>';
require_once ("moduls/foot.php");

?>