<?
Header("Content-type: image/png");

$concoun=$_GET["concoun"];
$maxcon=$_GET["maxcon"];

if ($maxcon==0) return;


$long=400;
$larg=400;
$image = imagecreate($larg,$long);


$noir = ImageColorAllocate($image,0,0,0); 
$vert = ImageColorAllocate($image,0,255,0);
$rouge = ImageColorAllocate($image,255,0,0);
$blanc = ImageColorAllocate($image,255,255,255);
$bleu = ImageColorAllocate($image,0,0,255);
$cyan = ImageColorAllocate($image,0,255,255);


$coun=explode("!",$concoun);
$K=0;

$coul=(array) null;
$coul[0]=$cyan;
$coul[1]=$vert;
$coul[2]=$rouge;
$coul[3]=$blanc;
$coul[4]=$bleu;
$coul[5]=$cyan;
$coul[6]=$vert;
$coul[7]=$rouge;
$coul[8]=$blanc;
$coul[9]=$bleu;
$coul[10]=$cyan;
$coul[11]=$vert;
$coul[12]=$rouge;
$coul[13]=$blanc;
$coul[14]=$bleu;
$coul[15]=$cyan;
$coul[16]=$vert;
$coul[17]=$rouge;
$coul[18]=$blanc;
$coul[19]=$bleu;
$coul[20]=$cyan;
$coul[21]=$vert;
$coul[22]=$rouge;
$coul[33]=$blanc;
$coul[24]=$bleu;

for ($i=0;$i<count($coun);$i++)
{
$tmp=explode("@",$coun[$i]);
$pays=$tmp[0];
$hit=$tmp[1];



//imagefilledrectangle($image,0,$K,399,$K+($hit*400)/100,$coul[$i]);
imagefilledrectangle($image,0,$K,399,$K+(400*(($hit*100)/$maxcon))/100, $coul[$i]);
imagestring($image,5,10,$K,$pays." ".round((($hit*100)/$maxcon))."%",$noir);
//if ($i==0) imagestring($image,5,10,30,$hit."=>".$maxcon."=>",$rouge);


//$K+=($hit*400)/100+1;

$per=($hit*100)/$maxcon;
$K+=(400*$per)/100;

}


//imagefilledrectangle($image,0,0,400,120,$blanc);



imagepng($image);


?>