Файл: statica.php
Строк: 26
<?
$p = abs((int)$_GET['p']);
$image = imagecreatetruecolor(102,10);
$fiol = imagecolorallocate($image, 85, 51, 213);
$white = imagecolorallocate($image, 255, 255, 255);
$blue = imagecolorallocate($image, 200, 210, 255);
$gold = imagecolorallocate($image, 253, 211, 122);
$red = imagecolorallocate($image, 248, 126, 84);
$orange = imagecolorallocate($image, 255, 230, 0);
$green = imagecolorallocate($image, 0, 255, 0);
$black = imagecolorallocate($image, 0, 0, 0);
imagefill($image, 0, 0, $fiol);
imagefilledrectangle($image, 1, 1, 100, 8, $white);
# 200 400 600 800 1000
# blue -> green -> orange -> red -> gold
if ( $p <= 200 && $p > 0 ) {
$blue = imagecolorallocate($image, 200, 210, 255);
$p = round( ($p) / 100 * 100 );
imagefilledrectangle($image, 1, 1, $p, 8, $blue);
}
else if ( $p <= 400 && $p > 200 ) {
$z = 100;
imagefilledrectangle($image, 1, 1, $z, 8, $blue);
$p = round( ( $p - 200 ) / 200 * 100 );
imagefilledrectangle($image, 1, 1, $p, 8, $green);
}
else if ( $p <= 600 && $p > 400 ) {
$z = 100;
imagefilledrectangle($image, 1, 1, $z, 8, $blue);
$p = round( ( $p - 400 ) / 400 * 100 );
imagefilledrectangle($image, 1, 1, $p, 8, $orange);
}
else if ( $p <= 800 && $p > 600 ) {
$z = 100;
imagefilledrectangle($image, 1, 1, $z, 8, $blue);
$p = round( ( $p - 400 ) / 400 * 100 );
imagefilledrectangle($image, 1, 1, $p, 8, $red);
}
else if ( $p > 800 ) {
$z = 100;
imagefilledrectangle($image, 1, 1, $z, 8, $blue);
$p = round( ( $p - 400 ) / 400 * 100 );
imagefilledrectangle($image, 1, 1, $p, 8, $gold);
}
imagestring($image, 1, 40, 1, $p.'%', $black);
header('Content-Type: image/gif');
imagegif($image);
imagedestroy($image);
?>