Просмотр файла rezult.php

Размер файла: 4.01Kb
<?php
#[-------------------------------------------]
#[=]                                       [=]
#[=]     Wap - Голосования                 [=]
#[=]                                       [=]
#[=]    Версия    -   2.0                  [=]
#[=]    Автор     -   chezz                [=]
#[=]    Мыло      -   [email protected]     [=]
#[=]    ICQ       -   29-48-48             [=]
#[=]                                       [=]
#[-------------------------------------------]
Error_Reporting(E_ALL & ~E_NOTICE);
Error_Reporting (ERROR | WARNING);


define('VOTES','1');


require_once ("config.php");  /////Подключаем настройки
require_once ("connect.php"); /////Подключаемся к БД
require_once ("func.php");    /////Подключаем функции
require_once ("lang.ini.php");/////Подключаем lang-файл
	
if(isset($_GET['id']) AND $_GET['id']!="")
{	
	body_begin();
	$id=filtr($id);
	$r=@mysql_query("SELECT * FROM ".$prefix."count WHERE id=".$id);
	$row = mysql_fetch_array($r);
	
	echo "<b>$lang[rezult]</b><br/>\n";
	
	
	/////////////////////////////////////Опять Достаем из базы вопрос и варианты ответов
	$r2=@mysql_query("SELECT * FROM ".$prefix."votes WHERE id=".$id);
	$questions=@mysql_query("SELECT question1, question2, question3, question4, question5, question6, question7, question8, question9, question10 FROM ".$prefix."votes WHERE id=".$id);
	$que = @mysql_fetch_array($questions);
	if ($que['question1']) $question[1]=$que['question1'];
	if ($que['question2']) $question[2]=$que['question2'];
	if ($que['question3']) $question[3]=$que['question3'];
	if ($que['question4']) $question[4]=$que['question4'];
	if ($que['question5']) $question[5]=$que['question5'];
	if ($que['question6']) $question[6]=$que['question6'];
	if ($que['question7']) $question[7]=$que['question7'];
	if ($que['question8']) $question[8]=$que['question8'];
	if ($que['question9']) $question[9]=$que['question9'];
	if ($que['question10']) $question[10]=$que['question10'];
	$question_count=count($question);
	$rr=@mysql_query("SELECT count1, count2, count3, count4, count5, count6, count7, count8, count9, count10 FROM ".$prefix."count WHERE id=".$id);
	$rowz = mysql_fetch_array($rr);
	if ($rowz['count1']) $countt[1]=$rowz['count1'];
	if ($rowz['count2']) $countt[2]=$rowz['count2'];
	if ($rowz['count3']) $countt[3]=$rowz['count3'];
	if ($rowz['count4']) $countt[4]=$rowz['count4'];
	if ($rowz['count5']) $countt[5]=$rowz['count5'];
	if ($rowz['count6']) $countt[6]=$rowz['count6'];
	if ($rowz['count7']) $countt[7]=$rowz['count7'];
	if ($rowz['count8']) $countt[8]=$rowz['count8'];
	if ($rowz['count9']) $countt[9]=$rowz['count9'];
	if ($rowz['count10']) $countt[10]=$rowz['count10'];
	////////////////////////////////////Конец

$countall = $row['countall'];


	
	$row2 = mysql_fetch_array($r2);
				$id = $row2['id'];
				$name = $row2['name'];
				
			echo "<p><u>$name</u></p>\n";///Вопрос

		
		for($i = 0;$i < $question_count;$i++)
		{		
				if(!isset($num)) $num=1;
				else $num++;
				$percent=$countt[$num]/$countall*100;
				//$percent=round($percent, 2);
				$percent=ceil($percent);
				
				if(!$countt[$num]) $countt[$num]=0;
				
				
				
				echo "&gt; $question[$num] - $countt[$num] ($percent%)<br/>\n";///Варианты Ответов
				
				$p=$percent;
				if ($p) echo "<img src=\"img.php?p=$p\" alt=\"$p%\"/><br/>";
				else echo"<br/>";
		}
		

		
	
	
	echo "<br/>$lang[allcount] <u>$countall</u> $lang[allcount2]<br/><br/>\n";
	echo "<a href=\"index.php?$m\">$lang[votes]</a><br/>\n";
	echo "<a href=\"http://$main_link\">$lang[main_name]</a>\n";
	xmllink();//Ссылка на xhtml или на wml
	echo "$copy";
	
mysql_close($connect);
	body_end();
}	
else ////////Если ничего не указано возвращаемся на главную страницу голосований
{
	header("Location: index.php?$m");
	exit();
}
?>