<?
include_once '../core/system.php';
echo only_reg();
echo ban();
$header = 'Модерация';
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_azo` SET `i` = '0' WHERE `guruh` = '$id' AND `user` = '$invite' LIMIT 1");
$q5=mysql_query("SELECT * FROM `guruh_azo` WHERE `guruh`='$id' AND `i`!='5' AND `i`!='2' AND `i`!='3' ORDER BY time DESC");
while($ark=mysql_fetch_array($q5)){
$arr=mysql_fetch_assoc(mysql_query("SELECT * FROM `user` WHERE `id` = '".$ark['user']."' LIMIT 1"));
$ass+=$arr['sila'];
//echo "$arr[sila]";
}
//echo "$ass $id ...";
mysql_query("UPDATE `clan` SET `up` = '$ass' WHERE `id` = '$id' LIMIT 1");
}
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("DELETE FROM `guruh_azo` WHERE `guruh` = '$id' and `user` = '$del' ");

}


$q5=mysql_query("SELECT * FROM `guruh_azo` WHERE `guruh`='$id' AND `i`='3' 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 `user` 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=/user/$id/$arr[id]/>$arr[nick]";
//echo savatar($arr['id']);
echo "</a>[<a href=/clan/mod.php?id=$id&invite=$arr[id]>Принять</a>] [<a href=/clan/mod.php?id=$id&del=$arr[id]>Отклонить</a>]</br>";
//echo "<div class=clear></div></div>";
}


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