<?php
##########################################################################
# #
# Vote for IT! #
# #
# #
# #
# This script is freeware and is realeased under the GPL #
# Copyright (C) 2002 #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# In diesem File wird die grafische Auswertung von Vote for IT! #
# gemacht. Hier müssen keine Änderungen gemacht werden. #
# #
# Die Kommentare und Copyrights dürfen nicht gelöscht werden #
# #
# Version 2.0.3 (c) T.Zenerino http://www.zenerino.ch #
# #
##########################################################################
//Datei results.dat auslesen
$filename = "results/results.dat";
if(file_exists($filename))
{
$file = fopen($filename,"r");
$line = fgets($file,1024);
$line = trim($line);
$results = explode("|",$line);
$counter1 = "$results[0]";
$counter2 = "$results[1]";
$counter3 = "$results[2]";
}
$total = $counter1+$counter2+$counter3;
if($counter1>0)
{
$zresult1 = $total/$counter1;
$defresult1 = round("100"/$zresult1,1);
}
else
{
$defresult1 = "0.1";
}
if($counter2>0)
{
$zresult2 = $total/$counter2;
$defresult2 = round("100"/$zresult2,1);
}
else
{
$defresult2 = "0.1";
}
if($counter3>0)
{
$zresult3 = $total/$counter3;
$defresult3 = round("100"/$zresult3,1);
}
else
{
$defresult3 = "0.1";
}
$image = imagecreate(150,15);
$color_body=imagecolorallocate($image,255,255,255);
$color_a = imagecolorallocate($image,255,0,0);
$color_b = imagecolorallocate($image,0,255,0);
$color_c = imagecolorallocate($image,0,0,255);
$var1 = $defresult1*"1.5";
$var2 = $defresult2*"1.5";
$var3 = $defresult3*"1.5";
if($imgnr==1)
{
if($var1>0)
{
imagefilledrectangle($image,0,0,$var1-1,15,$color_a);
}
}
if($imgnr==2)
{
if($var2>0)
{
imagefilledrectangle($image,0,0,$var2-1,15,$color_b);
}
}
if($imgnr==3)
{
if($var3>0)
{
imagefilledrectangle($image,0,0,$var3-1,15,$color_c);
}
}
header("Content-Type: image/png");
imagepng($image);
?>