<?
include_once '../core/system.php';
echo only_reg();
echo ban();
$header = 'clan';
include_once '../core/head.php';
$id=(int)$_GET['id'];

if (mysql_result(mysql_query("SELECT COUNT(*) FROM `guruh_azo` WHERE `guruh` = '$id' AND `user` = '$user[id]' AND `i` = '5' LIMIT 1"),0)==0){
echo "obman"; exit;
}

if (isset($_GET['invite'])){
$invite=(int)$_GET['invite'];
//echo "$invite , $id";
mysql_query("UPDATE `guruh_vrag` SET `i` = '2' WHERE `guruh` = '$id' AND `user` = '$invite' LIMIT 1");
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `guruh_vrag` WHERE `user` = '$invite' AND `guruh` = '$id' LIMIT 1"),0)!=0){ $err='1';}
if (!isset($err)){
mysql_query("INSERT INTO `guruh_vrag` (user,guruh,time,i) values('$invite','$id','$soat','2')");
}}
if (isset($_GET['del'])){
$del=(int)$_GET['del'];
//echo "$invite , $id";
//mysql_query("UPDATE `guruh_azo` SET `i` = '0' WHERE `guruh` = '$id' AND `user` = '$invite' LIMIT 1");
mysql_query("UPDATE `guruh_vrag` SET `i` = '2' WHERE `guruh` = '$id' AND `user` = '$invite' LIMIT 1");

}


$q5=mysql_query("SELECT * FROM `guruh_vrag` WHERE `guruh`='$id' AND `i`='1' ORDER BY time DESC LIMIT 10");
while($ark=mysql_fetch_array($q5)){
//$arr=get_user($ark['user']);
$arr=mysql_fetch_assoc(mysql_query("SELECT * FROM `clan` WHERE `id` = '".$ark['user']."' LIMIT 1"));
//if($num==1){ echo "<div class='even'>";$num=0;}else{echo "<div class='odd'>";$num=1;}

echo "<a href=/clan/clan.php?id=$arr[id]>$arr[name]";
//echo savatar($arr['id']);
echo "</a>[<a href=/clan/vrag.php?id=$id&invite=$arr[id]>Принять</a>] [<a href=/clan/vrag.php?id=$id&del=$arr[id]>Отклонить</a>]</br>";
//echo "<div class=clear></div></div>";
}


include_once '../core/foot.php';
?>