Aktuelle Umfrage auf Jens Home"; $varia=file("fragen.txt"); $frage=array_pop($varia); echo "$frage"; echo "
"; $i=0; while(isset($varia[$i])) { $j=$i+1; echo "$varia[$i]
"; $i++; } echo ""; echo "
"; $z=file("antworten.txt"); if ($ant!='') { $lvote=fopen("lastip.txt"); $lv=fgets($lvote,255); fclose($lvote); $ip=getenv("REMOTE_ADDR"); if ($lv!=$ip) { $z[$ant-1]=$z[$ant-1]+1; $datei=fopen("antworten.txt","w"); foreach ($z as $save) {fputs($datei,chop($save)."\n");} fclose($datei); $lvote=fopen("lastip.txt","w"); fputs($lvote,"$ip"); fclose($lvote); } } $laenge=90; $gesamt=0; foreach($z as $zahl) { $gesamt=$gesamt+$zahl; } $proz=array(); foreach ($z as $zahl) { if ($gesamt!=0) { $p=round($zahl/$gesamt*10000)/100; array_push($proz,$p); } } $max=1; foreach ($z as $zahl) { $zahl=$zahl*10/10; if($zahl > $max) { $max=$zahl; } } $breite=array(); foreach ($z as $zahl) { $b=$zahl*$laenge/$max; array_push($breite,$b); } $i=0; while (isset($z[$i])) { echo "$varia[$i]
"; echo "\"$z[$i]"; $x=$laenge-$breite[$i]; echo "\"$z[$i]"; echo "$proz[$i]%"; echo "
"; $i++; } echo "
Stimmen: $gesamt (100%)"; echo "

Ältere Umfragen"; echo "

Zurück"; ?>