View file adm_panel/stat.hit.php

File size: 1.27Kb
<?
include_once '../sys/inc/start.php';
//include_once '../sys/inc/compress.php';
include_once '../sys/inc/sess.php';
include_once '../sys/inc/home.php';
include_once '../sys/inc/settings.php';
include_once '../sys/inc/db_connect.php';
include_once '../sys/inc/ipua.php';
include_once '../sys/inc/fnc.php';
include_once '../sys/inc/adm_check.php';
include_once '../sys/inc/user.php';
user_access('adm_statistic',null,'index.php?'.SID);

// создаем изображение
$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));

//echo "$user_reg[$i] $x, $y1, $x, $y2<br />";
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);
?>