Вход Регистрация
Файл: profi_wm/top/graphic_world.php
Строк: 77
<?php
// by -=ШАХТЕР=- (waphp.ru - качай только тут)
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
include 
"config.php";
include 
'config.inc.php';
include 
'functions.inc.php';


//проверка  ввода id
if (empty($_GET['uid'])) exit;
$uid=$_GET['uid'];
$uid=@mysql_escape_string($uid);
// проверка существования учетной записи
$result mysql_query("SELECT link FROM top_users WHERE uid=$uid");
$row=mysql_fetch_row($result);
if (empty(
$row)) exit;

$week_day date("w");
$today date("Ymd");
// параметры диаграммы
$r 45;
$cx 50;
$cy 50;
$g1 0;
$g2 0;
// параметры сносок
$x_leg 10;
$y_leg 110;
$w_h 5;
$step 10;

// созданире изображения
$img ImageCreate(100,421);
$colorWhite imageColorAllocate($img255,255,255);
$colorBlack imageColorAllocate($img0,0,0);
$colorGrey imageColorAllocate($img180,180,180);
for (
$i=0;$i<6;$i++){
    
imageArc($img$cx$cy2*$r+$i2*$r+$i0360imageColorAllocate($img180+($i*10),180+($i*10),180+($i*10)));
}
imageFill($img$cx$cy$colorGrey);

$color = array(
    
imageColorAllocate($img237,27,35),
    
imageColorAllocate($img255,172,72),
    
imageColorAllocate($img56,181,73),
    
imageColorAllocate($img0,174,239),
    
imageColorAllocate($img255,0,255),
    
imageColorAllocate($img255,242,0),
    
imageColorAllocate($img0,0,255),
    
imageColorAllocate($img166,124,81),
    
imageColorAllocate($img183,183,183),
    
imageColorAllocate($img0,255,0),
    
imageColorAllocate($img255,0,0),
    
imageColorAllocate($img0,90,100),
    
imageColorAllocate($img0,255,153),
    
imageColorAllocate($img153,0,153),
    
imageColorAllocate($img153,204,0),
    
imageColorAllocate($img153,153,255),
    
imageColorAllocate($img255,104,208),
    
imageColorAllocate($img17,126,27),
    
imageColorAllocate($img217,9,107),
    
imageColorAllocate($img51,214,81),
    
imageColorAllocate($img239,235,122),
    
imageColorAllocate($img105,105,94),
    
imageColorAllocate($img231,186,29),
    
imageColorAllocate($img221,217,213),
    
imageColorAllocate($img146,11,129),
    
imageColorAllocate($img10,148,205),
    
imageColorAllocate($img139,248,185),
    
imageColorAllocate($img156,140,6),
    
imageColorAllocate($img196,85,247),
    
imageColorAllocate($img238,147,158),
    
imageColorAllocate($img231,134,29)
);

$tel = array(
    
"Russia",
    
"Ukraine",
    
"Belarus",
    
"Bulgaria",
    
"Finland",
    
"Estonia",
    
"Czechia",
    
"Sweden",
    
"France",
    
"Turkey",
    
"Romania",
    
"Poland",
    
"Germany",
    
"Holland",
    
"Denmark",
    
"Greece",
    
"Lithuania",
    
"Portugal",
    
"Italy",
    
"Hungary",
    
"England",
    
"USA",
    
"Canada",
    
"Australia",
    
"Ireland",
    
"Belgium",
    
"Spain",
    
"Kazakhstan",
    
"Brazil",
    
"Latvia",
    
"Other"
);

// данные телов
$result mysql_query("SELECT `ru`,`uk`,`be`,`bg`,`fi`,`et`,`cs`,`sv`,`fr`,`tr`,`ro`,`pl`,`de`,`nl`,`da`,`el`,`lt`,`pt`,`it`,`hu`,`en-gb`,`en-us`,`en-ca`,`en-au`,`en-ie`,`nl-be`,`es`,`kk`,`pt-br`,`lv`,`Other` FROM `world` WHERE `date`=$today AND `day_week`=$week_day AND `uid`=$uid LIMIT 1");
$tel_data mysql_fetch_row($result);
if (empty(
$tel_data)) exit;

$result mysql_query("SELECT `ru`+`uk`+`be`+`bg`+`fi`+`et`+`cs`+`sv`+`fr`+`tr`+`ro`+`pl`+`de`+`nl`+`da`+`el`+`lt`+`pt`+`it`+`hu`+`en-gb`+`en-us`+`en-ca`+`en-au`+`en-ie`+`nl-be`+`es`+`kk`+`pt-br`+`lv`+`Other` FROM `world` WHERE `date`=$today AND `day_week`=$week_day AND `uid`=$uid LIMIT 1");
$row mysql_fetch_row($result);
$sum_count $row[0];

$percent_data = array();
$grad = array();

foreach (
$tel_data as $index => $value)
{
    
$percent_data[$index] = $value/$sum_count*100;
    
$grad[$index] = $percent_data[$index]*360/100;
}

// ======================== создаём график ================
foreach ($grad as $index => $g)
{
    
$g2 $g1+$g;

    
imageArc($img$cx$cy2*$r2*$r$g1$g2$colorBlack);

    if (
$g1 == 0){
        
$x $cx $r;
        
$y $cy;
        
imageLine($img,$cx,$cy,$x,$y,$colorBlack);
    }

    
$x $r*cos($g2*pi()/180)+$cx;
    
$y $r*sin($g2*pi()/180)+$cy;
    
imageLine($img,$cx,$cy,$x,$y,$colorBlack);

    
$x = ($r-5)*cos(($g2+$g1)/2*pi()/180)+$cx;
    
$y = ($r-5)*sin(($g2+$g1)/2*pi()/180)+$cy;
    
// закраска области
    
if ($g 2){
        
imageFill($img$x$y$color[$index]);
    }
    
$g1 += $g;

    
// вывод легенды
    
imageFilledRectangle($img$x_leg$y_leg$x_leg+$w_h$y_leg+$w_h$color[$index]);
    
imageRectangle($img$x_leg$y_leg$x_leg+$w_h$y_leg+$w_h$colorBlack);
    
imageString($img1$x_leg+$w_h+5$y_leg+$w_h-6$tel[$index]."(".(int)$percent_data[$index]."%)"$colorBlack);
    
$y_leg += $step;
}
imageRectangle($img010599$y_leg$colorBlack);
imageFilledRectangle($img01055$y_leg$colorGrey);
imageRectangle($img01055$y_leg$colorBlack);

Header("Content-type: image/png");
ImagePNG($img);
ImageDestroy($img);
?>
Онлайн: 4
Реклама