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

####################Запись онлайна##################
mysql_query("UPDATE `profile` SET `online` = 'sivor' WHERE `id` = '".$id_session."'");
####################################################
echo head . "<b>Провокатор</b>" . div;
$ank['id'] = $id_session;
if (isset($_GET['id']))$ank['id'] = intval($_GET['id']);
$q = mysql_query("SELECT * FROM `profile` 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('".$id_session."', '".mysql_escape_string($_GET['id_ank'])."', '".mysql_escape_string($_GET['golos'])."', '".$q_sivor['name']."')");
header("Location: index.php");
}

$all = mysql_result(mysql_query("SELECT count(*) FROM `friends` WHERE `user_1` = '$ank[id]'"), 0);
if ( $all == 0 ) echo link1 . 'Чтобы воспользоваться данным модулем, добавьте друзей' . div;


$q = mysql_query("SELECT * FROM `friends` WHERE `user_1` = '$ank[id]' ORDER BY RAND() LIMIT 1");
while ($f = mysql_fetch_array($q))
{
	$a = mysql_fetch_array(mysql_query("SELECT * FROM `profile` WHERE `id` = '$f[user_2]' LIMIT 1"));
    
    if ($a['sett_sivor'] == 1) {
        echo link1 . 'Пользователь '.$a['login'].' не участвует в Провокаторе' . div;
    } else { 
$count= mysql_result(mysql_query("SELECT COUNT(*) FROM `sivor_user` WHERE `id_ank` = '".$id_session."'"), 0);
echo link1 . '<b><center><a href="spisok.php">Ответы про меня ('.$count.')</a></b>' . div;

    
     
    if($a['upload_ava']){
    $ava = link2 . '<center><a href="../profile.php?id='.$a['id'].'"><img src="../resize.php?img=upload_ava/'.$a['upload_ava'].'&width=100&height" alt=""/></a>';
    } else {
    $ava = link2 . '<center><a href="../profile.php?id='.$a['id'].'"><img src="../resize.php?img=noava.png&width=100&height" alt=""/></a>';
    }
    echo $ava . ' ';
    
	echo $sex . '<br/ >';
	echo '<a href="/info.php?id='.$a['id'].'">'.$a['login'].'</a>'.online($a['id'])."\n";
echo win2utf($qq[name]) . "<br/>";	
echo div . link2 . '<center><a href="?golos=1&id_ank='.$a['id'].'&sivor='.$qq['id'].'"><img src="img/b_yes.gif" alt=""></a>  <a href="?golos=2&id_ank='.$a['id'].'&sivor='.$qq['id'].'"><img src="img/b_no.gif" alt=""></a><br/></div></center><div class="link1"><center><a href="index.php">Пропустить</a></center></div>';

}
}


echo '</table>'."\n";


echo div;

navig();

foot();
?>