Файл: public_html/duel/voted.php
Строк: 106
<?
include_once '../sys/inc/start.php';
include_once '../sys/inc/sess.php';
include_once '../sys/inc/home.php';
include_once '../sys/inc/settings.php';
include_once '../sys/inc/db_connect.php';
include_once '../sys/inc/ipua.php';
include_once '../sys/inc/fnc.php';
include_once '../sys/inc/user.php';
only_reg();
$set['title']='Активные дуэли'; // заголовок страницы
include_once '../sys/inc/thead.php';
title();
aut();
include_once 'inc.php';
$k_post_vote=mysql_result(mysql_query("SELECT COUNT(*) FROM `duel` WHERE (SELECT COUNT(*) FROM `duel_vote` WHERE `duel`.`id` = `duel_vote`.`id_duel` AND `id_user` = '$user[id]') != 0 AND `act` = '1' AND `opponent` != '$user[id]' AND `user` != '$user[id]'"),0);
$k_page=$k_post_vote;
$page=page($k_page);
$start=$page-1;
if ($k_page==0)
{
echo '<div class="str">Нет активных дуэлей за которые вы голосовали</div>';
}
else
{
$post=mysql_fetch_array(mysql_query("SELECT * FROM `duel` WHERE (SELECT COUNT(*) FROM `duel_vote` WHERE `duel`.`id` = `duel_vote`.`id_duel` AND `id_user` = '$user[id]') != 0 AND `act` = '1' AND `opponent` != '$user[id]' AND `user` != '$user[id]' ORDER BY `id` DESC LIMIT $start, 1"));
$rand = rand(1000,9999);
echo "<div class='p_m'>";
if($post['rubric'] == 1) $cat = 'Кто красивее?';
if($post['rubric'] == 2) $cat = 'Кто сильнее?';
if($post['rubric'] == 3) $cat = 'Кто моднее?';
if($post['rubric'] == 4) $cat = 'Кто выглядит моложе?';
if($post['rubric'] == 5) $cat = 'Кто смешнее?';
if($post['rubric'] == 6) $cat = 'У кого лучше фигура?';
if($post['rubric'] == 7) $cat = 'Кто сексуальнее?';
if($post['rubric'] == 8) $cat = 'Кто гламурнее?';
if($post['rubric'] == 9) $cat = 'Кто аппетитнее?';
echo "<b>Категория:</b> <u><b>$cat</b></u><br/>";
echo "</div>";
$count=mysql_result(mysql_query("SELECT COUNT(*) FROM `duel_vote` WHERE `id_duel` = '$post[id]'"),0);
$us = mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = '".$post['user']."' LIMIT 1"));
$vote=mysql_result(mysql_query("SELECT COUNT(*) FROM `duel_vote` WHERE `id_duel` = '$post[id]' AND `id_opponent` = '$us[id]'"),0);
$man=mysql_result(mysql_query("SELECT COUNT(*) FROM `duel_vote` WHERE `id_duel` = '$post[id]' AND `id_opponent` = '$us[id]' AND `man` = '1'"),0);
$woman=mysql_result(mysql_query("SELECT COUNT(*) FROM `duel_vote` WHERE `id_duel` = '$post[id]' AND `id_opponent` = '$us[id]' AND `man` = '0'"),0);
$us2 = mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = '".$post['opponent']."' LIMIT 1"));
$vote2=mysql_result(mysql_query("SELECT COUNT(*) FROM `duel_vote` WHERE `id_duel` = '$post[id]' AND `id_opponent` = '$us2[id]'"),0);
$man2=mysql_result(mysql_query("SELECT COUNT(*) FROM `duel_vote` WHERE `id_duel` = '$post[id]' AND `id_opponent` = '$us2[id]' AND `man` = '1'"),0);
$woman2=mysql_result(mysql_query("SELECT COUNT(*) FROM `duel_vote` WHERE `id_duel` = '$post[id]' AND `id_opponent` = '$us2[id]' AND `man` = '0'"),0);
echo "<div class='menu'>n";
echo "Оппонент: <a href="/info.php?id=$us[id]">$us[nick]</a><br/>n";
avatar($post['user']);
echo "<br/>---<br/>n";
echo "<b>Голосов:</b> $vote (".@round($vote/$count*100,1)."%) <br />n";
echo "M: (".@round($man/$vote*100,1)."%) / Ж: (".@round($woman/$vote*100,1)."%)<br />n";
echo "</div>n";
echo "<div class='p_m'>n";
echo "Против<br/>n";
echo "</div>n";
echo "<div class='menu'>n";
echo "Оппонент: <a href="/info.php?id=$us2[id]">$us2[nick]</a><br/>n";
avatar($post['opponent']);
echo "<br/>---<br/>n";
echo "<b>Голосов:</b> $vote2 (".@round($vote2/$count*100,1)."%) <br />n";
echo "M: (".@round($man2/$vote2*100,1)."%) / Ж: (".@round($woman2/$vote2*100,1)."%)<br />n";
echo "</div>n";
echo '<div class="str">Время окончания: <strong>'.vremja($post['time']).'</strong></div>';
}
if ($k_page>1)str("?",$k_page,$page); // Вывод страниц
echo '<div class="foot">
- <a href="myduels.php">Моя дуэль</a><br/>
- <a href="finished.php">Завершенные</a><br/>
- <a href="./">Дуэли</a></div>';
include_once '../sys/inc/tfoot.php';
?>