<?php
include '../config.php';
include '../func.php';
head();
aut();
ban();

echo head . '<b>Сыворотка правды:</b>' . div;


if (isset($_GET['win']))
{
if ($many_session>5){
mysql_query("UPDATE `profile` SET `many` = '".($many_session-5)."' WHERE `id` = '".$id_session."' LIMIT 1");
mysql_query("UPDATE `sivor_user` SET `win` = '1' WHERE `id` = '".mysql_escape_string($_GET['win'])."' LIMIT 1");
header("Location: spisok.php");
}
else {
echo link1 . 'Не достаточно баллов' . div;
}
}

$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `sivor_user` WHERE `id_ank` = '".$id_session."'"), 0);

if ($k_post==0)echo link1 . 'Нет чемпионатов!' . div;

if($k_post){
$onpage = 5;
$allpage = ceil($k_post/$onpage);
$this_page = (isset($_GET['p'])) ? intval($_GET['p']) : 1 ;
if($this_page < 1 || $this_page > $allpage)$this_page = 1;
$start = $this_page*$onpage - $onpage;

$q = mysql_query("SELECT * FROM `sivor_user` WHERE `id_ank` = '".$id_session."' ORDER BY `id` DESC limit ".$start.",".$onpage."");
while ($f = mysql_fetch_array($q))
{
if($num==1){
echo "<div class='link2'>";
$num=0;}
else{
echo "<div class='link2'>";
$num=1;}
echo win2utf($f[name]) ."<br/>\n";
$q_user=mysql_fetch_array(mysql_query("SELECT * FROM `profile` WHERE `id`='".$f[id_user]."'"));
if (isset($user) &&$f[win]==1) echo "$q_user[login] :";
if (isset($user) &&$f[golos]==1)echo " <b><font color=blue>ДА</font></b>\n"; else echo " <b><font color=red>НЕТ</font></b>\n";
if (isset($user) &&$f[win]==0) echo "<a href='?win=$f[id]'>Кто ответил?</a> [5 монет]";
echo "</div>";
}
echo link1 . '<b>Страницы:</b> ';
navigation($allpage,"spisok.php?p={p}",1,1);
}



navig();
foot();

?>