<?
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';
only_reg();
title();
aut();
################################################################################
$ank['id'] = $user['id'];
if (isset($_GET['id']))$ank['id'] = intval($_GET['id']);
$q = mysql_query("SELECT * FROM `user` WHERE `id` = $ank[id] LIMIT 1");
if (mysql_num_rows($q)==0){header("Location: index.php?".SID);exit;}
################################################################################
$ank = mysql_fetch_array($q);
$qq=mysql_fetch_array(mysql_query("SELECT * FROM `sivor` ORDER BY RAND() "));
################################################################################
if (isset($_GET['golos']) && $_GET['id_ank'] && $_GET['sivor'])
{
$q_sivor=mysql_fetch_array(mysql_query("SELECT * FROM `sivor` WHERE `id`='".mysql_escape_string($_GET['sivor'])."'"));
mysql_query("INSERT INTO `sivor_user`(`id_user`, `id_ank`, `golos`, `name`) VALUES('".$user['id']."', '".mysql_escape_string($_GET['id_ank'])."', '".mysql_escape_string($_GET['golos'])."', '".$q_sivor['name']."')");
header("Location: index.php");
}
################################################################################
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `frends` WHERE `user` = '$ank[id]' AND `i` = '1'"), 0);
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
################################################################################
$q = mysql_query("SELECT * FROM `frends` WHERE `user` = '$ank[id]' AND `i` = '1' ORDER BY RAND(), time DESC LIMIT $start, 1");
while ($f = mysql_fetch_array($q))
{
$a = mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = '$f[frend]' LIMIT 1"));
$count= mysql_result(mysql_query("SELECT COUNT(*) FROM `sivor_user` WHERE `id_ank` = $user[id]",$db), 0);
echo "<div class='f1'><a href='otv.php'>Ответы про меня ($count)</a></div>\n";
echo "<div class='f1'><center>\n";
avatar($a['id']);echo "<br />";
echo "".status($a['id'])." ";
echo "<a href='/info.php?id=$a[id]'><span style=\"color:$a[ncolor]\">$a[nick]</span></a>\n";
echo "".medal($a['id'])." ".online($a['id'])."<br />";
echo "<div class='f2'>$qq[name]</div>";	
echo "<a href='?golos=1&id_ank=$a[id]&sivor=$qq[id]'><img src='img/da.png'></a>  <a href='?golos=2&id_ank=$a[id]&sivor=$qq[id]'><img src='img/net.png'></a><br/><a href='index.php'>Пропустить</a></center>\n";
echo "</center></div>\n";
}
################################################################################
include_once '../../sys/inc/tfoot.php';
?>