<?php
# МОД СЫВОРАТКА ПРАВДЫ
# KAZAMA
# 383991000
error_reporting(0);
include_once '../sys/inc/start.php';
include_once '../sys/inc/compress.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';
$set['title']='Ответы про меня';
include_once '../sys/inc/thead.php';
title();
aut();



if (!isset($user)){
echo "Гостям вход запрешён";
include_once '../sys/inc/tfoot.php';
}



$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `sivor_user` WHERE `id_ank` = '$user[id]'"), 0);
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
if ($k_post==0)echo '<div class="menu">Нет вопросов!</div>';
$q = mysql_query("SELECT * FROM `sivor_user` WHERE `id_ank` = '$user[id]' ORDER BY `id` DESC LIMIT $start, $set[p_str]");
while ($f = mysql_fetch_array($q))
{
if($num==1){
echo "<div class='p_m'>";
$num=0;}
else{
echo "<div class='p_m'>";
$num=1;}
echo "$f[name]<br/>\n";
$q_user=mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id`='".$f[id_user]."'"));
if (isset($user) &&$f[win]==1) echo "$q_user[nick] :";
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='?page=$page&win=$f[id]'>Кто ответил?</a> [50 бал.]";
echo "</div>";

if (isset($_GET['win']))
{
if ($user['balls']>50){
mysql_query("UPDATE `user` SET `balls` = '".($user['balls']-50)."' WHERE `id` = '$user[id]' LIMIT 1");
mysql_query("UPDATE `sivor_user` SET `win` = '1' WHERE `id` = '".mysql_escape_string($_GET['win'])."' LIMIT 1");
header("Location: spisok.php?page=$page");
}
else {
echo '<div class=err>Не достаточно баллов<div>';
}
}


}
echo "<div class='foot'>";
if ($k_page>1)str("?",$k_page,$page); // Вывод страниц
echo "</div>";


include_once '../sys/inc/tfoot.php';

?>