<?php
include_once("files/zag.php");
include_once("files/ini.php");
$polz=mysql_query("SELECT * FROM `users` WHERE `udata0`='$log' AND `udata1`='$pas' LIMIT 1");
if(mysql_num_rows($polz)==0){
header ("Location: index.php?error");
echo'<div class="p">Ошибка! Пользователь с таким логином и паролем не зарегистрирован, или пароль/логин неверен! <a href="index.php">На главную</a><br>';exit;
}else{
if($udata23!=="$log"){echo'Ошибка!'; include_once"files/down.php"; exit;}
$a=mysql_query("SELECT * FROM `clan_alliance` WHERE `glava`='$log' ");
$arr= mysql_fetch_array($a);
if($arr['glava']!=="$log"){echo'Ошибка!'; include_once"files/down.php"; exit;}
$a=mysql_query("SELECT * FROM `alliance` WHERE `usr`='$log' ");
$arr= mysql_fetch_array($a);
if($arr['usr']=="$log"){echo'Глава альянса не может уйти !'; include_once"files/down.php"; exit;}
$date=date("d.m.y");
$time=date("H:i");
$aglava=mysql_query("SELECT * FROM `alliance` WHERE `usr`='$udata90' ");
$arrs= mysql_fetch_array($aglava);
$ggg1=$arrs['id'];
mysql_query("DELETE FROM `clan_alliance` WHERE `glava`='".$log."'");
$aglava=mysql_query("SELECT * FROM `clan` WHERE `clan0`='$udata23' ");
$arrs= mysql_fetch_array($aglava);
$ggg=$arrs['clan1'];
$qi = mysql_query("SELECT * FROM `clan_people` WHERE `clan_people1`='$ggg' ");
while($row=mysql_fetch_array($qi))
{
mysql_query("UPDATE `users` SET `udata90`='' WHERE `udata0`='".$row['clan_people0']."'"); }
echo"Вы вышли из альянса.";
}
include_once"files/down.php";
?>