Вход Регистрация
Файл: panel/statistic.php
Строк: 87
<?php

/* DCMS Special
 * Дата последнего редактирования 14.12.2015
 * Модифицировал densnet
 */

foreach (array('start', 'compress', 'sess', 'settings', 'db_connect', 'ipua', 'fnc', 'adm_check', 'user') as $inc) {
    require_once 
"../sys/inc/{$inc}.php";
}

access('adm_statistic', null, 'index.php?' . SID);
adm_check();

$set['title'] = 'Статистика сайта';
require_once 
H . 'sys/inc/thead.php';

aut();
err();

$mod = (isset($_GET['mod'])) ? htmlspecialchars($_GET['mod']) : null;

#Навигация
echo "<ol class='breadcrumb'>";
echo 
"<li><a href='/'><span class='fa fa-home fa-fw'></span></a></li>";
echo 
"<li><a href='/panel/'>Панель управления</a></li>";
echo 
"<li class='active'>Статистика сайта</li>";
echo 
"</ol>";

switch (
$mod) {
    default:
        echo 
"<div class='list-group-item'>";
        echo 
"Уникальные посещения:<br /><img src = '?mod=1&amp;SESS=$sess' alt = 'Уникальные посетители' /><br />";
        echo 
"Переходы по страницам:<br /><img src = '?mod=2&amp;SESS=$sess' alt = 'Переходы по страницам' /><br />";
        echo 
"Кол-во регистраций:<br /><img src = '?mod=3&amp;SESS=$sess' alt = 'Регистрации' /><br />";
        echo 
"Кол-во созданных тем:<br /><img src = '?mod=4&amp;SESS=$sess' alt = 'Новые темы в форуме' /><br />";
        echo 
"Кол-во сообщений в форуме:<br /><img src = '?mod=5&amp;SESS=$sess' alt = 'Новые сообщения в форуме' />";
        echo 
"</div>";
        break;

    case 
'1':
        
#создаем изображение
        
$img = imagecreatetruecolor(120, 50);
        
#заливаем белым
        
imagefill($img, 0, 0, imagecolorallocate($img, 255, 255, 255));
        
$line_col = imagecolorallocate($img, 100, 100, 100);
        
$text_col = imagecolorallocate($img, 60, 60, 60);
        
$sh_col = imagecolorallocate($img, 255, 200, 200);
        
$max = 0;

        for (
$i = 0; $i < 100; $i++) {
            
$host = @mysql_result(@mysql_query("SELECT `host_ip_ua` FROM `visit_everyday` ORDER BY `time` DESC LIMIT $i,1"), 0);
            
$max = max($max, $host);
            
$hosts[$i] = $host;
        }

        for (
$i = 0; $i < 100; $i++) {
            
$x = 119 - $i;
            
$y1 = 49;
            
imageline($img, $x, 0, $x, $i % 30 ? 1 : 5, $sh_col);
            
$y2 = 49 - intval(40 * ($max ? ($hosts[$i] / $max) : 0));
            
imageline($img, $x, $y1, $x, $y2, $line_col);
        }
        
imagestring($img, 1, 3, 1, "max:$max", $text_col);
        @
ob_end_clean();
        
header("Content-type: image/png");
        
imagepng($img);
        break;

    case 
'2':
        
$img = imagecreatetruecolor(120, 50);
        
imagefill($img, 0, 0, imagecolorallocate($img, 255, 255, 255));
        
$line_col = imagecolorallocate($img, 100, 100, 100);
        
$text_col = imagecolorallocate($img, 60, 60, 60);
        
$sh_col = imagecolorallocate($img, 255, 200, 200);
        
$max = 0;

        for (
$i = 0; $i < 100; $i++) {
            
$hit = @mysql_result(@mysql_query("SELECT `hit` FROM `visit_everyday` ORDER BY `time` DESC LIMIT $i,1"), 0);
            
$max = max($max, $hit);
            
$hits[$i] = $hit;
        }

        for (
$i = 0; $i < 100; $i++) {
            
$x = 119 - $i;
            
$y1 = 49;

            
imageline($img, $x, 0, $x, $i % 30 ? 1 : 5, $sh_col);

            
$y2 = 49 - intval(40 * ($max ? ($hits[$i] / $max) : 0));
            
imageline($img, $x, $y1, $x, $y2, $line_col);
        }

        
imagestring($img, 1, 3, 1, "max:$max", $text_col);
        @
ob_end_clean();
        
header("Content-type: image/png");
        
imagepng($img);
        break;

    case 
'3':
        
$img = imagecreatetruecolor(120, 50);
        
imagefill($img, 0, 0, imagecolorallocate($img, 255, 255, 255));
        
$line_col = imagecolorallocate($img, 100, 100, 100);
        
$text_col = imagecolorallocate($img, 60, 60, 60);
        
$sh_col = imagecolorallocate($img, 255, 200, 200);
        
$max = 0;

        for (
$i = 0; $i < 100; $i++) {
            
$day_start = mktime(0, 0, 0, date('m'), date('d') - $i);
            
$day_finish = mktime(0, 0, 0, date('m'), date('d') - $i + 1);
            
$user_t = @mysql_result(@mysql_query("SELECT COUNT(*) FROM `user` WHERE `date_reg` >= '$day_start' AND `date_reg` < '$day_finish'"), 0);
            
$max = max($max, $user_t);
            
$user_reg[$i] = $user_t;
        }

        for (
$i = 0; $i < 100; $i++) {
            
$x = 119 - $i;
            
$y1 = 49;

            
imageline($img, $x, 0, $x, $i % 30 ? 1 : 5, $sh_col);

            
$y2 = 49 - intval(40 * ($max ? ($user_reg[$i] / $max) : 0));
            
imageline($img, $x, $y1, $x, $y2, $line_col);
        }

        
imagestring($img, 1, 3, 1, "max:$max", $text_col);

        @
ob_end_clean();
        
header("Content-type: image/png");
        
imagepng($img);
        break;

    case 
'4':
        
$img = imagecreatetruecolor(120, 50);
        
imagefill($img, 0, 0, imagecolorallocate($img, 255, 255, 255));
        
$line_col = imagecolorallocate($img, 100, 100, 100);
        
$text_col = imagecolorallocate($img, 60, 60, 60);
        
$sh_col = imagecolorallocate($img, 255, 200, 200);
        
$max = 0;

        for (
$i = 0; $i < 100; $i++) {
            
$day_start = mktime(0, 0, 0, date('m'), date('d') - $i);
            
$day_finish = mktime(0, 0, 0, date('m'), date('d') - $i + 1);
            
$forum_t = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_t` WHERE `time_create` >= '$day_start' AND `time_create` < '$day_finish'"), 0);
            
$max = max($max, $forum_t);
            
$forum_themes[$i] = $forum_t;
        }

        for (
$i = 0; $i < 100; $i++) {
            
$x = 119 - $i;
            
$y1 = 49;
            
imageline($img, $x, 0, $x, $i % 30 ? 1 : 5, $sh_col);
            
$y2 = 49 - intval(40 * ($max ? ($forum_themes[$i] / $max) : 0));
            
imageline($img, $x, $y1, $x, $y2, $line_col);
        }
        
imagestring($img, 1, 3, 1, "max:$max", $text_col);
        @
ob_end_clean();
        
header("Content-type: image/png");
        
imagepng($img);
        break;

    case 
'5':

        
$img = imagecreatetruecolor(120, 50);
        
imagefill($img, 0, 0, imagecolorallocate($img, 255, 255, 255));
        
$line_col = imagecolorallocate($img, 100, 100, 100);
        
$text_col = imagecolorallocate($img, 60, 60, 60);
        
$sh_col = imagecolorallocate($img, 255, 200, 200);
        
$max = 0;

        for (
$i = 0; $i < 100; $i++) {
            
$day_start = mktime(0, 0, 0, date('m'), date('d') - $i);
            
$day_finish = mktime(0, 0, 0, date('m'), date('d') - $i + 1);
            
$forum_p = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_p` WHERE `time` >= '$day_start' AND `time` < '$day_finish'"), 0);
            
$max = max($max, $forum_p);
            
$forum_posts[$i] = $forum_p;
        }

        for (
$i = 0; $i < 100; $i++) {
            
$x = 119 - $i;
            
$y1 = 49;
            
imageline($img, $x, 0, $x, $i % 30 ? 1 : 5, $sh_col);
            
$y2 = 49 - intval(40 * ($max ? ($forum_posts[$i] / $max) : 0));
            
imageline($img, $x, $y1, $x, $y2, $line_col);
        }
        
imagestring($img, 1, 3, 1, "max:$max", $text_col);
        @
ob_end_clean();
        
header("Content-type: image/png");
        
imagepng($img);
        break;
}

require_once 
H . 'sys/inc/tfoot.php';
Онлайн: 2
Реклама