View file v2.php
<?php include 'inc/db.php'; include 'inc/1.php'; $id=intval($_GET['id']); $vote=mysql_fetch_assoc(mysql_query("SELECT * FROM `user_vote` WHERE `id` = '$id'")); $q=mysql_query("SELECT `id` FROM `user_vote` WHERE `id` = '$id'"); if (mysql_num_rows($q)==0){ header("Location: /vote.php"); exit; } $v1=mysql_num_rows(mysql_query("SELECT * FROM `user_votes` WHERE `vote` = '$id' AND `num` = '1'")); $v2=mysql_num_rows(mysql_query("SELECT * FROM `user_votes` WHERE `vote` = '$id' AND `num` = '2'")); $v3=mysql_num_rows(mysql_query("SELECT * FROM `user_votes` WHERE `vote` = '$id' AND `num` = '3'")); $v4=mysql_num_rows(mysql_query("SELECT * FROM `user_votes` WHERE `vote` = '$id' AND `num` = '4'")); $v5=mysql_num_rows(mysql_query("SELECT * FROM `user_votes` WHERE `vote` = '$id' AND `num` = '5'")); $v6=mysql_num_rows(mysql_query("SELECT * FROM `user_votes` WHERE `vote` = '$id' AND `num` = '6'")); $c=2; if ($v3)$c++; if ($v4)$c++; if ($v5)$c++; if ($v6)$c++; $vv1=intval($v1/($v1+$v2+$v3+$v4+$v5+$v6)*100); $vv2=intval($v2/($v1+$v2+$v3+$v4+$v5+$v6)*100); $vv3=intval($v3/($v1+$v2+$v3+$v4+$v5+$v6)*100); $vv4=intval($v4/($v1+$v2+$v3+$v4+$v5+$v6)*100); $vv5=intval($v5/($v1+$v2+$v3+$v4+$v5+$v6)*100); $vv6=intval($v6/($v1+$v2+$v3+$v4+$v5+$v6)*100); echo "<div class='msg'><b>".htmlspecialchars($vote['name'])."</b><br>".out($vote['msg'])."</div>"; echo "<div class='input'><a href='v3.php?id=$id&vote=1'>".htmlspecialchars($vote['v1'])."</a> - $v1 <b>($vv1%)</b></div>"; echo "<div class='input'><a href='v3.php?id=$id&vote=2'>".htmlspecialchars($vote['v2'])."</a> - $v2 <b>($vv2%)</b></div>"; if ($vote['v3'])echo "<div class='input'><a href='v3.php?id=$id&vote=3'>".htmlspecialchars($vote['v3'])."</a> - $v3 <b>($vv3%)</b></div>"; if ($vote['v4'])echo "<div class='input'><a href='v3.php?id=$id&vote=4'>".htmlspecialchars($vote['v4'])."</a> - $v4 <b>($vv4%)</b></div>"; if ($vote['v5'])echo "<div class='input'><a href='v3.php?id=$id&vote=5'>".htmlspecialchars($vote['v5'])."</a> - $v5 <b>($vv5%)</b></div>"; if ($vote['v6'])echo "<div class='input'><a href='v3.php?id=$id&vote=6'>".htmlspecialchars($vote['v6'])."</a> - $v6 <b>($vv6%)</b></div>"; echo "<div class='p0'><a href='vote.php'><b>Опросы</b></a></div>"; include 'inc/foot.php'; ?>