Файл: tankon.mobi/tanks/clans.php
Строк: 282
<?
include_once '../sys/inc/start.php';
include_once '../sys/inc/compress.php';
include_once '../sys/inc/sess.php';
include_once '../sys/inc/home.php';
include_once '../sys/inc/settings.php';
include_once '../sys/inc/db_connect.php';
include_once '../sys/inc/ipua.php';
include_once '../sys/inc/fnc.php';
include_once '../sys/inc/user.php';
include_once '../sys/inc/thead.php';
title();
err();
aut();
echo '<link rel="stylesheet" href="style.css" type="text/css" />';
include_once 'function.php';
if (isset($user))$ank['id']=$user['id'];
if (isset($_GET['id']))$ank['id']=intval($_GET['id']);
$ank=get_user($_GET['id']);
$coes = mysql_fetch_array(mysql_query("SELECT * FROM `collective` WHERE `id`='".intval($_GET['id'])."'"));
if ($coes==0){header ("Location: /users?clan");}
elseif ($ank['id']==$mc['id']){header ("Location: /myclan");}
$mcc = mysql_fetch_array(mysql_query("SELECT * FROM `collective` WHERE `id` = '".intval($_GET['id'])."'"));
$mcc['users_max'] = ($mcc['soil']*3) + 10;
$mcc['users'] = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `collective_user` WHERE `id_collective` = '$mcc[id]'"),0);
if(isset($_GET['gk']) && $mcu['status']==1)
{
if($mc['level']>=10){
$bat_clanas=mysql_result(mysql_query("SELECT COUNT(*) FROM `tanks_wartournament` WHERE `napad` = '".$mc['id']."' AND `konec`<'2'"), 0);
$bat_clanas1=mysql_result(mysql_query("SELECT COUNT(*) FROM `tanks_wartournament` WHERE `zakaz` = '".$mc['id']."' AND `konec`<'2'"), 0);
$bat_clanas2=mysql_result(mysql_query("SELECT COUNT(*) FROM `tanks_wartournament` WHERE `zakaz` = '".$mcc['id']."' AND `konec`<'2'"), 0);
$bat_clanas3=mysql_result(mysql_query("SELECT COUNT(*) FROM `tanks_wartournament` WHERE `napad` = '".$mcc['id']."' AND `konec`<'2'"), 0);
if($bat_clanas==0){
if($bat_clanas1==0){
if($bat_clanas2==0){
if($bat_clanas3==0){
$batt_zol = mysql_fetch_array(mysql_query("SELECT * FROM `collective` WHERE `id`='".$ank['id']."'"));
if($batt_zol['level']>=10){
if($mc['fishki']>=1){
if($mc['zolota']>=100){
if($batt_zol['zolota']>=100){
$rds=mysql_query("SELECT * FROM `tanks_wartournament` WHERE `napad`='".$mc['id']."'");
while ($del_post = mysql_fetch_array($rds)){
mysql_query("DELETE FROM `tanks_wartournament` WHERE `id` = '".$del_post['id']."'");
mysql_query("DELETE FROM `tanks_wartournament_users` WHERE `tour` = '".$del_post['id']."'");
}
$rdsk=mysql_query("SELECT * FROM `tanks_wartournament` WHERE `zakaz`='".$mc['id']."'");
while ($del_postk = mysql_fetch_array($rdsk)){
mysql_query("DELETE FROM `tanks_wartournament` WHERE `id` = '".$del_postk['id']."'");
mysql_query("DELETE FROM `tanks_wartournament_users` WHERE `tour` = '".$del_postk['id']."'");
}
$rdsko=mysql_query("SELECT * FROM `tanks_wartournament` WHERE `zakaz`='".$mcc['id']."'");
while ($del_postko = mysql_fetch_array($rdsko)){
mysql_query("DELETE FROM `tanks_wartournament` WHERE `id` = '".$del_postko['id']."'");
mysql_query("DELETE FROM `tanks_wartournament_users` WHERE `tour` = '".$del_postko['id']."'");
}
$rdskoo=mysql_query("SELECT * FROM `tanks_wartournament` WHERE `zakaz`='".$mcc['id']."'");
while ($del_postkoo = mysql_fetch_array($rdskoo)){
mysql_query("DELETE FROM `tanks_wartournament` WHERE `id` = '".$del_postkoo['id']."'");
mysql_query("DELETE FROM `tanks_wartournament_users` WHERE `tour` = '".$del_postkoo['id']."'");
}
$time_bat=time()+3600;
mysql_query("INSERT INTO `tanks_wartournament` (`napad`,`zakaz`,`time`) VALUES ('$mc[id]','$ank[id]','$time_bat')");
mysql_query("UPDATE `collective` SET `zolota` = `zolota`-'100', `fishki` = `fishki`-'1' WHERE `id` = '$mc[id]'");
mysql_query("UPDATE `collective` SET `zolota` = `zolota`-'100' WHERE `id` = '$ank[id]'");
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `tanks_wartournament` WHERE `napad`='".$mc['id']."' OR `zakaz`='".$mc['id']."'"), 0)>2){
}
header("Location:/myclan?battle");
}else{err_game('В клана противника не хватает золота');}
}else{err_game('У вас в клане не хватает золота');}
}else{err_game('У вас в клане не хватает фишек');}
}else{err_game('Клан противника не достиг 10-го уровня');}
}else{err_game('У этого клана уже есть высадка');}
}else{err_game('У этого клана уже есть высадка');}
}else{err_game('Дождитесь завершения вашей высадки');}
}else{err_game('Дождитесь завершения вашей высадки');}
}else{err_game('Ваш клан не достиг 10 уровня');}
}
elseif(isset($_GET['stran']))
{
echo '<div class="trnt-block p5" style="margin-bottom:4px;">';
if($mcc['trebText_time']=='не менялись'){
echo "<div class='medium white sh_b bold cntr'>Страница клана (не менялись)</div>";
}else{echo "<div class='medium white sh_b bold cntr'>Страница клана (".vremja($mcc['trebText_time']).")</div>";
}
echo "<div class='small white bold'>".$mcc['treb']."";
echo'</div></div>';
echo'<a class="simple-but gray" href="/clans?id='.$mcc['id'].'"><span><span>Назад</span></span></a></div>';
include_once'foots.php';
exit;
}
echo '<div class="trnt-block" style="margin-bottom:3px;">
<div class="wrap1">
<div class="wrap2">
<div class="wrap3">
<div class="wrap4">
<div class="wrap5">
<div class="wrap6">
<div class="wrap7">
<div class="wrap8">
<div class="wrap-content">';
echo'<table><tr><td style = " width : 0px ; " >';
echo'<div w:id="hqLink" class="thumb inbl m5""><img width="50" height="50" src="/images/hq.png"><span class="mask1"> </span><span class="digit esmall"><span class="l"> </span><span class="m">'.$mcc['soil'].'</span><span class="r"> </span></span></div>
<div w:id="hqLink" class="thumb inbl m5""><img width="50" height="50" src="/images/fuelDepot.png"><span class="mask1"> </span><span class="digit esmall"><span class="l"> </span><span class="m">'.$mcc['irrigate'].'</span><span class="r"> </span></span></div></td>';
echo'<td style = " width : 250px ; " ><div class="cntr"><img style="max-width:200px;width:100%;border-radius:7px;" src="/images/clan.png"></div></td>';
echo'<td style = " width : 0px ; " ><div w:id="hqLink" class="thumb inbl m5""><img width="50" height="50" src="/images/barracks.png"><span class="mask1"> </span><span class="digit esmall"><span class="l"> </span><span class="m">'.$mcc['scholl'].'</span><span class="r"> </span></span></div>
<div w:id="hqLink" class="thumb inbl m5""><img width="50" height="50" src="/images/polygon.png"><span class="mask1"> </span><span class="digit esmall"><span class="l"> </span><span class="m">'.$mcc['vet'].'</span><span class="r"> </span></span></div></td>';
echo'</tr></table>';
echo'</div></div>
</div>
</div>
</div></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div></div>
</div>';
echo'<div class="cntr fs0 mb2">
<div class="inbl prel medium">
</div>
</div>
</div>';
echo '<div class="trnt-block" style="margin-bottom:5px">
<div class="wrap1">
<div class="wrap2">
<div class="wrap3">
<div class="wrap4">
<div class="wrap5">
<div class="wrap6">
<div class="wrap7">
<div class="wrap8">
<div class="wrap-content">';
echo "<div class='small white sh_b bold'> <img src='/tanks/images/clan/exp.png' width='16' height='16'> Опыт: ".rating($mcc['rating'])."<br>";
echo "<img src='/tanks/images/clan/levels.png' width='16' height='16'> Уровень: ".$mcc['level']."<br>";
echo "<img src='/tanks/images/clan/name.png' width='16' height='16'> Название клана: ".$mcc['name']."<br>";
echo "<img src='/tanks/images/clan/rass.png' width='16' height='16'> Расшифровка: ".$mcc['rass']."<br>";
echo'</div></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div></div>
</div>
</div>';
echo'<a class="simple-but green" href="/clans?id='.$mcc['id'].'&stran"><span><span>Страница клана</span></span></a></div>';
if($mcu['status']==1 && $mc['fishki']>0){
echo'<a class="simple-but red" href="/clans?id='.$mcc['id'].'&gk"><span><span>Заказать высадку, у вас '.$mc['fishki'].' фиш.</span></span></a></div>';
}
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `collective_user` WHERE `id_collective` = '".$mcc['id']."'"),0);
if ($k_post==0)
{
echo "Список пуст...";
}
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
$num=($page-1)*$set['p_str'];
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `collective_user` WHERE `id_collective` = '".$mcc['id']."'"),0);
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
$num=($page-1)*$set['p_str'];
if(isset($_GET['rat'])){
$q=mysql_query("SELECT * FROM `collective_user` WHERE `id_collective` = '".$mcc['id']."' ORDER BY `rating` DESC LIMIT $start, 7");
}else{
$q=mysql_query("SELECT * FROM `collective_user` WHERE `id_collective` = '".$mcc['id']."' ORDER BY `status` ASC LIMIT $start, 7");
}
echo'<div class="trnt-block p5" style="margin-bottom:3px;"><div class="cntr white medium bold">Штаб '.$mcc['users'].' из '.$mcc['users_max'].'</div></div>';
if(isset($_GET['rat'])){echo'<a class="simple-but green" href="/clans?id='.$mcc['id'].'"><span><span>Сортировать по званию</span></span></a></div>';}
else{echo'<a class="simple-but green" href="/clans?id='.$mcc['id'].'&rat"><span><span>Сортировать по опыту</span></span></a></div>';}
echo'<div class="trnt-block p5" style="margin-bottom:3px;">';
while($post=mysql_fetch_array($q))
{
$num++;
$uk=mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = '$post[id_user]'"));
echo'<span class="white medium bold">'.anscs($uk['id']).' <img src="/images/icons/exp.png"> '.rating($post['rating']).'</span><br>';
}
echo'</div>';
if(isset($_GET['rat'])){if ($k_page>1){str("/clans?id=".$_GET['id']."&rat&",$k_page,$page);}}
else{if ($k_page>1){str("/clans?id=".$_GET['id']."&",$k_page,$page);}}
echo'<a class="simple-but gray" href="/users?clan"><span><span>К рейтингу кланов</span></span></a></div>';
include_once 'foots.php';
?>