if (!isset($_GET['pid'])) {
header("Location: /");
die;
}
$x=unpack('N',base64_decode($_GET['pid']."=="));
if (!is_numeric($x[1]) || ($x[1]/768<1) || ($x[1]/768>255) || ($x[1]/768%0>0) ) {
header("Location: /");
die;
}
header("Content-Type: text/html; charset=utf-8");
include("forum/admin/config.php");
mysql_connect($servername,$dbusername,$dbpassword);
mysql_select_db($dbname);
echo "";
echo "";
echo "
Vysledky ankety\n";
echo "";
echo "Volba | Hlasu | Lidi |
";
$totalvoters=array();$totalothers=array();
$i=$x[1]/768;
$voters=array();$others=array(); $votedates=array();
$pollqry=mysql_query("select question,options from poll where pollid=$i");
$poll=mysql_fetch_array($pollqry);
echo "".iconv("windows-1250","utf8",$poll[question])." |
";
$polloptions=split('\|\|\|',$poll['options']);
$votesmc=array_fill(0,count($polloptions),0);
$votesoth=array_fill(0,count($polloptions),0);
$votesnew=array_fill(0,count($polloptions),0);
$mcnames=array();$othnames=array();$newnames=array();
$voteqry=mysql_query("select voteoption,username,usertitle,from_unixtime(votedate) as vdate from pollvote left join user using (userid) where pollid=$i");
while ($vote=mysql_fetch_array($voteqry)) {
$votedates[$vote[username]]=$vote[vdate];
$votesoth[$vote['voteoption']-1]++;
$othnames[$vote['voteoption']-1].="$vote[username], ";
}
foreach ($polloptions as $id => $name) {
echo "".iconv("windows-1250","utf8",$name)." | ";
echo "$votesoth[$id] | $othnames[$id] |
";
}
echo "
";
?>