Файл: social12/rating.php
Строк: 49
<?php
$percent = (int)abs($_GET['p']);
if ($percent >= 0 && $percent <= 100) $ratimg = 'red.gif';
else $ratimg = 'yellow.gif';
if ($percent > 100) $percent = $percent - (intval($percent / 100) * 100);
echo '<img src="/ico/profile/' . $ratimg . '" width="' . $percent . '" height="5" alt=""/><img src="/ico/profile/green.gif" width="' . (100 - $percent) . '" height="5" alt=""/>';
/*
$p = abs((int)$_GET['p']);
$image = imagecreatetruecolor(101, 8);
$fiol = imagecolorallocate($image, 255, 255, 255);
$aqua = imagecolorallocate($image, 0, 154, 205);
$blue = imagecolorallocate($image, 30, 144, 255);
$gold = imagecolorallocate($image, 144, 238, 144);
$red = imagecolorallocate($image, 137, 104, 205);
$funshia = imagecolorallocate($image, 255, 20, 147);
$yellow = imagecolorallocate($image, 255, 255, 0);
$fire = imagecolorallocate($image, 139, 26, 26);
$wood = imagecolorallocate($image, 162, 205, 90);
$darkb = imagecolorallocate($image, 0, 0, 205);
$darkg = imagecolorallocate($image, 46, 139, 87);
$grey = imagecolorallocate($image, 139, 134, 130);
$black = imagecolorallocate($image, 0, 0, 0);
imagefill($image, 0, 0, $fiol);
imagefilledrectangle($image, 1, 1, 1000, 8, $blue);
if ($p <= 100 && $p > 0) {
$blue = imagecolorallocate($image, 240, 128, 128);
$p = round(($p) / 50 * 50);
imagefilledrectangle($image, 1, 1, $p, 8, $blue);
}
elseif ($p <= 200 && $p > 100) {
$z = 100;
imagefilledrectangle($image, 1, 1, $z, 8, $blue);
$x = round(($p - $z) / 100 * 100);
imagefilledrectangle($image, 1, 1, $x, 8, $yellow);
}
elseif ($p <= 300 && $p > 200) {
$z = 200;
imagefilledrectangle($image, 1, 1, $z, 8, $blue);
$x = round(($p - $z) / 100 * 100);
imagefilledrectangle($image, 1, 1, $x, 8, $funshia);
}
elseif ($p <= 400 && $p > 300) {
$z = 300;
imagefilledrectangle($image, 1, 1, $z, 8, $blue);
$x = round(($p - $z) / 100 * 100);
imagefilledrectangle($image, 1, 1, $x, 8, $red);
}
elseif ($p <= 500 && $p > 400) {
$z = 400;
imagefilledrectangle($image, 1, 1, $z, 8, $blue);
$x = round(($p - $z) / 100 * 100);
imagefilledrectangle($image, 1, 1, $x, 8, $gold);
}
elseif ($p <= 600 && $p > 500) {
$z = 500;
imagefilledrectangle($image, 1, 1, $z, 8, $blue);
$x = round(($p - $z) / 100 * 100);
imagefilledrectangle($image, 1, 1, $x, 8, $fire);
}
elseif ($p <= 700 && $p > 600) {
$z = 600;
imagefilledrectangle($image, 1, 1, $z, 8, $blue);
$x = round(($p - $z) / 100 * 100);
imagefilledrectangle($image, 1, 1, $x, 8, $wood);
}
elseif ($p <= 800 && $p > 700) {
$z = 700;
imagefilledrectangle($image, 1, 1, $z, 8, $blue);
$x = round(($p - $z) / 100 * 100);
imagefilledrectangle($image, 1, 1, $x, 8, $darkb);
}
elseif ($p <= 900 && $p > 800) {
$z = 800;
imagefilledrectangle($image, 1, 1, $z, 8, $blue);
$x = round(($p - $z) / 100 * 100);
imagefilledrectangle($image, 1, 1, $x, 8, $darkg);
}
elseif ($p <= 1000 && $p > 900) {
$z = 900;
imagefilledrectangle($image, 1, 1, $z, 8, $blue);
$x = round(($p - $z) / 100 * 100);
imagefilledrectangle($image, 1, 1, $x, 8, $grey);
}
elseif ($p > 1000 || $p < 0) {
exit('Неверные параметры рейтинга!');
}
imagestring($image, 0, 43, 0, $p.'%', $black);
header('Content-Type: image/gif');
imagegif($image);
imagedestroy($image);
*/
?>