$fil[0] 

"; for ($i=1; $i < sizeof($fil); $i++) { $temp = explode("=",$fil[$i]); print "\n"; } print "
$temp[0]
$error
"; // footer print "
\"Guest
\"home\"
"; // footer exit; } function vote() // голосуем { global $date, $vote, $checkip, $checkcookie; if($checkip) checkip(); if($checkcookie) checkcookie(); if($vote): if(file_exists("nums/$date.txt")) { $num = file("nums/$date.txt"); $num[0] += 1; $f = fopen("nums/$date.txt","w"); fputs($f,$num[0]); fclose($f); } else { $f = fopen("nums/$date.txt","w"); fputs($f,"1"); fclose($f); } $fil = file("q"); $temp = explode("=",$fil[$vote]); $temp[1] += 1; $fil[$vote] = $temp[0]."=".$temp[1]."\n"; $f = fopen("q","w"); foreach($fil as $fi) { fputs($f,$fi); } fclose($f); else: form("Please SELECT the artwork You like
Results"); endif; } function checkip() // Проверка IP { global $ip; $filip = file("ad"); foreach($filip as $fi) { if(chop($fi) == $ip) { form("Sorry, you have already voted
Results"); } } $f = fopen("ad","a"); fputs($f,"$ip\n"); fclose($f); } function checkcookie() // проверка cookie { global $industvoter,$cookietime; if($industvoter == "yes") { form("C этого компьютера уже голосовали!"); } else { setcookie("industvoter","yes",time()+$cookietime); } } // выводим результаты $fil = file("q"); for ($i=1; $i < sizeof($fil); $i++) { $temp = explode("=",$fil[$i]); $mess[$i] = $temp[0]; $num[$i] = chop($temp[1]); } $max = 0; $sum = 0; for ($i=1; $i < sizeof($fil); $i++) { $sum = $sum + $num[$i]; if($num[$i] > $max) $max = $num[$i]; } if($max == 0) { $max = 1; } $koeff = $graphLenght/$max; print "$fil[0]

\n"; print "\n"; $c = 1; for ($i=1; $i < sizeof($fil); $i++) { $width = floor($num[$i]*$koeff); $number += $num[$i]; $percent = 0; if($sum != 0) { $percent = $num[$i]/$sum*100; $percent = floor($percent*100+0.5)/100; } $image = "img/$i.gif"; if($width == 0) { if($c == 0) { $c = 1; print "\n"; } else { $c = 0; print "\n"; } } else { if($c == 0) { $c = 1; print "\n"; } else { $c = 0; print "\n"; } } } $today = file("nums/$date.txt"); if(!$today[0]) { $today[0] = 0; } print "
$mess[$i] $num[$i]  ($percent%)
$mess[$i] $num[$i]  ($percent%)
$mess[$i] $num[$i]  ($percent%)
$mess[$i] $num[$i]  ($percent%)

 Total votes: $number 
 Votes today: $today[0] 
"; // footer print"
\"Guest
\"home\"
"; // footer ?>