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

Размер файла: 3.88Kb
<?php
////////////////////////////////////////////
//                                          
//     Скрипт Голосований на MySql          
//                                          
//    Версия     -   1.0 (wap1.1)           
//    Автор      -   CHEZZ                  
//    гМыло :)   -   [email protected]       
//    wap-сайт   -   http://underwap.net    
//                                          
////////////////////////////////////////////

Error_Reporting(E_ALL & ~E_NOTICE);

header("Pragma: no-cache");
header ("Content-type:text/vnd.wap.wml; charset=utf-8");


include "config.php";  /////Подключаем настройки
include "connect.php"; /////Подключаемся к БД
include "func.php";    /////Подключаем функции

	
if(isset($id) AND $id)
{	
	body_begin();
	$id=filtr($id);
	$r=mysql_query("SELECT * FROM vote_count WHERE id="."$id"."");
	$row = mysql_fetch_array($r);
	
	echo "<b>Результаты:</b><br/>\n";
	
	
	/////////////////////////////////////Опять Достаем из базы вопрос и варианты ответов
	$r2=mysql_query("SELECT * FROM vote_votes WHERE id="."$id"."");
	$questions=mysql_query("SELECT question1, question2, question3, question4, question5, question6, question7, question8, question9, question10 FROM vote_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 vote_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>$name</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/>Всего проголосовало <u>$countall</u> человек<br/><br/>\n";
	echo "<a href=\"index.php\">Голосования</a><br/>\n";
	echo "<a href=\"http://$main_link\">$main_name</a>\n";
	echo "$copy";
	
mysql_close($connect);
	body_end();
}	
else ////////Если ничего не указано возвращаемся на главную страницу голосований
{
	header("Location: http://$path");
	exit();
}
?>