<?php
include '../system/bd.php';
include '../system/cook.php';
include ("../system/gzip.php");
if(isset($_SESSION['auth']) && $_SESSION['auth']==1){
include '../system/head.php';
include '../system/head1.php';
$req = mysql_query("SELECT * FROM `user` WHERE `id` = '$user[id]'");
////////////////////////////
$avto=mysql_num_rows($req);
if($avto=="0"){
echo'Ошибка 1';
include 'inc/nogi.php';
exit;
}
$us = mysql_fetch_array($req);
if(empty($us[clan])){
echo' <div class="title">Ошибка</div>
<div class="empty_block item_center"> Вы не состоите в банде! </div>';
echo'<div class="block_link">';
echo"<a href='../index.php'> <img src ='../img/images/arrow.png'> Вернуться</a></div>";
include '../system/foot.php';
exit;}
/////////////

if($us[clan]!="$clans[id]"){

$req = mysql_query("SELECT * FROM `clans` where `id`='$us[clan]' or `leader`='$us[clan]' ");

$req = mysql_query("SELECT * FROM `clans` where `id`='$us[clan]' or `leader`='$us[clan]' ");

$avto=mysql_num_rows($req);
if($avto==1){
$clan1 = mysql_fetch_array($req);
$req = mysql_query("SELECT `id` FROM `user` where `clan`='$clan1[id]'");



////////////////////////////
$kk=mysql_num_rows($req);


echo '' ;

switch($_GET[mod]){
default:

if($user[clan_prava] == 'leader'){

echo' <div class="title">Распустить</div>';

echo ' <div class="block_link">
 <table width="100%" border="0" cellpadding="0" cellspacing="0" style="color:#E5CBB7">
<tbody>
<tr>
<td align="center" width="50%"><a href="?mod=yes">
Да</a></td> 

<td align="center"><a href="?">Нет</a>
</td></tr></tbody></table></div>';
}else{
header ("Location: ../error.php");
}      
break;

case 'yes':
if($user[clan_prava] == 'leader'){

$req = mysql_query("SELECT `id` FROM `user` WHERE `clan` = '$user[clan]' LIMIT 1");
$claner = mysql_fetch_array($req);

    mysql_query("UPDATE `user` SET 
`clan` = '0',
`clan_prava` = 'no',
`clan_exp` = '0'
WHERE `clan` = '$user[clan]'");

mysql_query("UPDATE `user` SET
 `clan` = '0',
`clan_prava` = 'no',
`clan_exp` = '0'
WHERE `id` = '$claner[id]'");


   mysql_query("DELETE FROM `clans` WHERE `id` = '$user[clan]'");
   mysql_query("DELETE FROM `clans_chat` WHERE `id` = '$user[clan]'");

echo' все';
exit;
}else{
header ("Location: ../error.php");
}      
break;



             //////////




}
} else{
echo"Ошибка 3";
include '../system/foot.php';
exit;}
}
//////////////////

}else{
header ("Location: index.php"); exit;
}
include '../system/foot.php';
?>
