<?php
if(!defined('DATALIFEENGINE')){
die( "Hacking attempt!" );
}
$is_change = false;
if ($config['allow_cache'] != "yes") {
$config['allow_cache'] = "yes";
$is_change = true;
}
$uStats = dle_cache( "uStats", $config['skin'] );
$row = $db->super_query( "SELECT COUNT(*) as count FROM " . PREFIX . "_comments" );
$count_comments = $row['count'];
$row = $db->super_query( "SELECT COUNT(*) as count FROM " . PREFIX . "_post" );
$stats_news = $row['count'];
$temp_date = date( 'Y-m-d H:i', $_TIME - (3596 * 24) );
$row = $db->super_query( "SELECT COUNT(*) as count FROM " . PREFIX . "_post WHERE date >= '$temp_date'AND date <= '$temp_date' + INTERVAL 24 HOUR AND approve ='1'" );
$stats_day = $row['count'];
$temp_date = date( 'Y-m-d H:i', $_TIME - (3596 * 24) );
$row = $db->super_query( "SELECT COUNT(*) as count FROM " . PREFIX . "_comments WHERE date >= '$temp_date'AND date <= '$temp_date' + INTERVAL 24 HOUR" );
$comments_day = $row['count'];
$temp_date = $_TIME - (3600 * 24 * 31);
$row = $db->super_query( "SELECT COUNT(*) as count FROM " . USERPREFIX . "_users WHERE reg_date > '$temp_date'" );
$user_month = $row['count'];
$temp_date = $_TIME - (3600 * 24 * 7);
$row = $db->super_query( "SELECT COUNT(*) as count FROM " . USERPREFIX . "_users WHERE reg_date > '$temp_date'" );
$user_week = $row['count'];
$temp_date = $_TIME - (7200 * 24);
$row = $db->super_query( "SELECT COUNT(*) as count FROM " . USERPREFIX . "_users WHERE reg_date > '$temp_date'" );
$user_every = $row['count'];
$temp_date = $_TIME - (3600 * 24);
$row = $db->super_query( "SELECT COUNT(*) as count FROM " . USERPREFIX . "_users WHERE reg_date > '$temp_date'" );
$users_day = $row['count'];
$db->query( "SELECT user_group,reg_date FROM " . PREFIX . "_users" );
$admin_sum = 0;
$moder_sum = 0;
$vip_sum = 0;
$user_sum = 0;
$prouser_sum = 0;
while ($row = $db->get_row()) {
switch ($row['user_group']) {
case "1":
$admin_sum++;
break;
case "2":
$moder_sum++;
break;
case "3":
$vip_sum++;
break;
case "4":
$user_sum++;
break;
case "6":
$prouser_sum++;
break;
}
}
$stats_users = $admin_sum + $moder_sum + $vip_sum + $prouser_sum + $user_sum + 1; // +1 для правильного определения колличества пользователей.
$uStats = <<<HTML
<div align="left" style="color:#666; padding-left:5px;">
<div class="tipsy-left" style="float:right" title="Добавлено новостей за день">+$stats_day </div>
<i class="icon-layers"></i> Новостей: <font color="#000">$stats_news</font>
<br><div class="tipsy-left" style="float:right" title="Добавлено комментариев за день">+$comments_day  </div>
<i class="icon-bubbles"></i> Комментариев: <font color="#000">$count_comments</font>
<br><div class="tipsy-left" style="float:right" title="Зарегистрировалось пользователей за сегодня">+$users_day </div>
<i class="icon-people"></i> Пользователей: <font color="#000">$stats_users</font>
</div>
HTML;
echo $uStats;
if ($is_change) $config['allow_cache'] = false;
?>
$temp_date = $_TIME - (3600 * 24 * 31);
$row = $db->super_query( "SELECT COUNT(*) as count FROM " . USERPREFIX . "_users WHERE reg_date > '$temp_date'" );
$user_month = $row['count'];
$temp_date = $_TIME - (3600 * 24 * 7);
$row = $db->super_query( "SELECT COUNT(*) as count FROM " . USERPREFIX . "_users WHERE reg_date > '$temp_date'" );
$user_week = $row['count'];
$temp_date = $_TIME - (7200 * 24);
$row = $db->super_query( "SELECT COUNT(*) as count FROM " . USERPREFIX . "_users WHERE reg_date > '$temp_date'" );
$user_every = $row['count'];
$temp_date = $_TIME - (3600 * 24);
$row = $db->super_query( "SELECT COUNT(*) as count FROM " . USERPREFIX . "_users WHERE reg_date > '$temp_date'" );
$users_day = $row['count'];
$db->query( "SELECT user_group,reg_date FROM " . PREFIX . "_users" );
$admin_sum = 0;
$moder_sum = 0;
$vip_sum = 0;
$user_sum = 0;
$prouser_sum = 0;
while ($row = $db->get_row()) {
switch ($row['user_group']) {
case "1":
$admin_sum++;
break;
case "2":
$moder_sum++;
break;
case "3":
$vip_sum++;
break;
case "4":
$user_sum++;
break;
case "6":
$prouser_sum++;
break;
}
}
$stats_users = $admin_sum + $moder_sum + $vip_sum + $prouser_sum + $user_sum + 1; // +1 для правильного определения колличества пользователей.