Файл: public_html/clan.php
Строк: 1102
<?
$_SESSION['arena'] = 0;
include './system/common.php';
include './system/functions.php';
include './system/user.php';
if(!$user) {
header('location: /');
exit;
}
if($clan_memb['day'] == null or $clan_memb['day'] == 0){
mysql_query('UPDATE `clan_memb` SET `day` = '.date("d").' WHERE `user` = "'.$user['id'].'"');
}
$id = _string(_num($_GET['id']));
if(!$id && $clan) {
$id = $clan['id'];
}
$i = mysql_query('SELECT * FROM `clans` WHERE `id` = "'.$id.'"');
$i = mysql_fetch_array($i);
if(!$i) {
header('location: /clans/');
exit;
}
switch($_GET['action']) {
default:
$title = 'Клан "'.$i['name'].'"';
include './system/h.php';
?>
<div class='main'>
<?
if($clan && $clan['id'] == $i['id'] && $clan_memb['rank'] == 4 OR $clan_memb['rank'] == 5 && $_GET['adm'] == true) {
$text = _string($_POST['text']);
if($text) {
mysql_query('INSERT INTO `clan_msg` (`clan`,
`user`,
`text`,
`time`) VALUES ("'.$clan['id'].'",
"'.$user['id'].'",
"'.$text.'",
"'.time().'")');
header('location: /clan/');
}
?>
<div class='block_zero'>
<form action='/clan/?adm=true' method='post'>
Новое обьявление:<br/> <input name='text' class='text'/> <br>
<span class='btn'><span class='end'><input class='label' type='submit' value='Отправить'>Отправить</span></span>
</form>
</div>
<div class='mini-line'></div>
<?
}
?>
<div class='block_zero'>
<?
$_exp = round(100 / (clan_exp($i['level']) / $i['exp']));
if($_exp > 100) {
$_exp = 100;
}
?>
<table cellpadding='0' cellspacing='0'><tr>
<td>
<?
if($clan && $clan['id'] == $i['id'] && $clan_memb['rank'] == 4 OR $clan_memb['rank'] == 5) {
?>
<a href='/clan/gerb/'>
<?
}
?>
<img src='/images/icon/clan/gerb/<?=$i['gerb']?>.png' alt='*'/>
<?
if($clan && $clan['id'] == $i['id'] && $clan_memb['rank'] == 5 OR $clan_memb['rank'] == 4) {
?>
</a>
<?
}
?>
</td><td valign='top' style='padding-left: 5px;'><img src='/images/icon/clan/<?=$i['r']?>.png' alt=''*/> <b><?=$i['name']?></b><br/>
<img src='/images/icon/level.png'/> Уровень: <b><?=$i['level']?></b><br/>
<img src='/images/icon/exp.png' alt='*'/> Опыт: <?=n_f($i['exp'])?> / <?=n_f(clan_exp($i['level']))?> <font color='#999'>(<?=$_exp?>%)</font></td>
</tr></table>
</div>
<div class='mini-line'></div>
<?
if($clan['id'] == $i['id']) {
?>
<div class="mini-line"></div>
<div class="menuList">
<li class="original">
<a class="white" href="/clan/built/"><img src="/images/icon/clan/building.png" alt="" style="float:left;margin-top:3px;" height="30px" width="30px">
<img src="/images/icon/clan.png" alt="">Статуя клана </a>
<span class="medium"><?=($clan['built_1'] > 0 ? '<span class="dgreen bold">+'.$clan_buff.'</span> к параметрам':'<span class="dgreen bold">+0</span> к параметрам')?></span></a>
</li>
<a class="white" href="/clan/<?=$id?>/quest/"><img src="/images/19.png" alt="" style="float:left;margin-top:3px;" height="30px" width="30px">
<img src="/images/icon/clan.png" alt="">Клановые задания<br>
<span class="medium"><img src="/images/icon/crys/diamond.png" alt=""> <?=($clan['plat'])?> кристаллов</span></a>
</li>
</div>
</div>
</center></center>
<hr>
<?
$_hellworld = mysql_fetch_array(mysql_query("SELECT * FROM `clan_dungeon` WHERE `clan` = ".$clan['id'].""));
if($clan['id'] == $i['id']&& $clan['clandungeon'] == 1 && $_hellworld['level'] < 11) {
?>
<div class="mini-line"></div>
<div class="menuList">
<li class="original">
<a class="white" href="/clandungeon/"> <img src="/images/hellworld/<?=(!$_hellworld ? '1' : ''.$_hellworld['level'].'');?>.png" alt="" height="35px" width="35px" style="float:left;margin-top:1px;">
<img src='http://tiwar.ru/images/icon/hellworld.png' alt=''/>Подземелье, <img src="/images/icon/level.png" alt="*"><?=(!$_hellworld ? '1' : ''.$_hellworld['level'].'');?> <font color='#90c090'> (+)</font><br>
<span class="medium">Битва с тварями из преисподней</span></a></li>
</div>
<div class="mini-line"></div>
<?
}
?>
<div class="mini-line"></div>
<div class="menuList">
<li class="original">
<a class="white" href="/clan/money/"><img src="/images/icon/clan/chest.png" alt="" style="float:left;margin-top:3px;" height="30px" width="30px">
<img src="/images/icon/gold.png" alt="">Казна клана<br>
<span class="medium"><img src="/images/icon/silver.png" alt="silver"><?=n_f($clan['s'])?> <img src="/images/icon/gold.png" alt="gold"><?=n_f($clan['g'])?></span></a></li>
</div>
<?
}
?>
<div class="mini-line"></div>
<div class="menuList">
<?
if($clan['id'] == $i['id']) {
$_chat = mysql_query('SELECT COUNT(*) FROM `chat` WHERE `clan` = "'.$clan['id'].'" AND `to` = "'.$user['id'].'" AND `read` = "0"');
$_chat = mysql_result($_chat,0);
?>
<li><a href='/clan/journal'><img src='/images/journal.png' alt='*'/> Журнал клана</a></li>
<li><a href="/chat/clan/"><img src="/images/icon/chat.png" alt="">Чат клана <?=($_chat > 0 ? '<font color='#3c3'>(+)</font>':'')?></a></li></div>
<?
$count = mysql_result(mysql_query('SELECT COUNT(*) FROM `chat` WHERE `clan` = "'.($clan['id']).'"'),0);
if($count > 0) {
$msg = _string(_num($_GET['msg']));
if($msg) {
$i_msg = mysql_query('SELECT * FROM `chat` WHERE `id` = "'.$msg.'"');
$i_msg = mysql_fetch_array($i_msg);
if(!$i_msg) {
header('location: /chat/'.('clan/').'?page='.$page);
exit;
}
if($_GET['clan'] == true && $clan_memb['rank'] == 5 OR $user['access'] > 0) {
mysql_query('DELETE FROM `chat` WHERE `clan` = "'.($clan['id']).'" AND`id` = "'.$i_msg['id'].'"');
}
header('location: /chat/'.('clan/').'?page='.$page);
}
$q = mysql_query('SELECT * FROM `chat` WHERE `clan` = "'.($clan['id']).'" ORDER BY `id` DESC LIMIT 3');
while($row = mysql_fetch_array($q)) {
if($row['to'] == $user['id'] && $row['read'] == 0) {
mysql_query('UPDATE `chat` SET `read` = "1" WHERE `id` = "'.$row['id'].'"');
}
$sender = mysql_query('SELECT * FROM `users` WHERE `id` = "'.$row['user'].'"');
$sender = mysql_fetch_array($sender);
echo "<br>";
echo "".($sender['id'] != 0 ? "<img src='/images/icon/race/".$sender['r'].($sender['online'] > (time() - 1200) ? '':'-off').".png' alt='*'/>":'<img src='/images/icon/race/bot.png' alt="*"/>')." ";
echo "".($sender['id'] != 0 ? "<a href='/user/".$sender['id']."/'>".$sender['login']." </a>":'Система')."";
if($sender['id'] != $user['id']) {
echo "".($sender['id'] != 0 ? "<a href='/chat/".($_GET['clan'] == true ? '':'clan/')."?to=".$sender['id']."'> (»)</a>":'')."";
}
if($row['to']) {
$__to = mysql_query('SELECT * FROM `users` WHERE `id` = "'.$row['to'].'"');
$__to = mysql_fetch_array($__to);
if($__to['id'] == $user['id']) {
?>
<font color='#90c090'>
<?
}
?>
<?=$__to['login']?>,
<?
if($__to['id'] == $user['id']) {
?>
</font>
<?
}
}
if($sender['access'] == 1) {
?>
<font color='#f09060'>
<?
}
?>
<?
if($sender['access'] == 2) {
?>
<font color='#90c0c0'>
<?
}
?>
<?=smiles($row['text'])?>
<?
if($sender['access'] > 0) {
?>
</font>
<?
}
if($user['access'] > 0) {
?>
<a href='/chat/<?=('clan/')?>?msg=<?=$row['id']?>'>[x]</a>
<?
}
}
}
else
{
?>
<?
}
?>
<div class="menuList">
<?
}
$max = 10;
$count = mysql_result(mysql_query('SELECT COUNT(*) FROM `clan_memb` WHERE `clan` = "'.$i['id'].'"'),0);
$pages = ceil($count/$max);
$page = _string(_num($_GET['page']));
if($page > $pages) {
$page = $pages;
}
if($page < 1) {
$page = 1;
}
$start = $page * $max - $max;
if(!$clan){
$za = mysql_fetch_array(mysql_query('SELECT * FROM `clan_z` WHERE `clan` = '.$i['id'].''));
if(!$za){
if($_GET['zay'] == '1'){
mysql_query('INSERT INTO `clan_z` (`user`,`clan`)VALUES('.$user['id'].','.$i['id'].')');
}
?>
<?
}else{
?>
<?
}
}
?>
<div class='block_zero center'>В клане <span class='bold'><?=$count?></span> титанов <br/>
<? if($clan['id'] == $i['id']) {
?>
<a class='grey' href='/online/?action=clan'>поиск игроков в клан</a></div>
<?
}
?>
</div><div class='dot-line'></div>
<?
if($count > 0) {
$q = mysql_query('SELECT * FROM `clan_memb` WHERE `clan` = "'.$i['id'].'" ORDER BY `rank` DESC,`exp` DESC LIMIT '.$start.', '.$max.'');
while($row = mysql_fetch_array($q)) {
$memb = mysql_query('SELECT * FROM `users` WHERE `id` = "'.$row['user'].'"');
$memb = mysql_fetch_array($memb);
switch($row['rank']) {
case 0:
$rank = 'Новобранец';
break;
case 1:
$rank = 'Боец';
break;
case 2:
$rank = 'Офицер';
break;
case 3:
$rank = 'Генерал';
break;
case 4:
$rank = '<font color='#95b9c7'>Зам. лидера</font>';
break;
case 5:
$rank = '<font color='#3c3'>Лидер клана</font>';
break;
}
if($clan && $clan['id'] == $i['id'] && $row['user'] != $user['id'] && $clan_memb['rank'] == 4 OR $clan_memb['rank'] == 5 && $_GET['adm'] == true) {
?>
<span style='float: right;'><a href='/clan/memb/<?=$row['id']?>/'><img src='/images/icon/settings.png' alt='*'/></a></span>
<?
}
?>
<div class='mini-line'></div><div class='menuList'><li><a style='padding-bottom:2px;padding-top:2px;' href='/user/<?=$row['user']?>/'><img src='/images/icon/race/<?=$memb['r'],($memb['online'] > time() - 300 ? '':'-off')?>.png' alt=''/><?=$memb['login']?>, <span class='white'><?=$rank?></span><br/><span class='grey'> <?=n_f($row['exp'])?> опыта</span></a></li></div>
<?
}
?><div class='mini-line'></div>
<?=pages('/clan/'.$i['id'].'/'.($_GET['adm'] == true ? '?adm=true&':'?'))?>
<div class='mini-line'></div>
<div class='main'>
<div class='menuList'>
<div class="block_zero"><img src="/images/icon/clan.png" alt=""> О клане: <?=$i['infa']?></div>
<?
$Month_r = array(
"1" => "Января",
"2" => "Февраля",
"3" => "Марта",
"4" => "Апреля",
"5" => "Мая",
"6" => "Июня",
"7" => "Июля",
"8" => "Августа",
"9" => "Сентября",
"10" => "Октября",
"11" => "Ноября",
"12" => "Декабря");
?>
<div class="block_zero"><img src="/images/icon/clan.png" alt=""> Клан Основан: <?=$i['day']?> <?=$Month_r[$i['mounth']]?> <?=$i['year']?> года</div>
<div class='mini-line'></div>
<?
}
else
{
?>
<?
}
?>
</div>
<?
if($clan && $clan['id'] == $i['id']) {
if(isSet($_GET['exit']) && $clan_memb['rank'] != 5) {
echo '<div class="god3">
<center>
<font color="red">Внимания!</font> Вы решили покинуть клан?<br/><br/>
<div class="link_center"><a href="?exit=true"class="btn"><span class="end"><span class="label">Да,выйти</a> / <a href="/clan/"class="btn"><span class="end"><span class="label">Нет,передумал</a>';
echo '</center></div><div class="hr"></div>';}else{
}
if($_GET['exit'] == true && $user['g'] >= 0) {
mysql_query('DELETE FROM `clan_memb` WHERE `clan` = "'.$clan['id'].'" AND `user` = "'.$user['id'].'"');
mysql_query("DELETE FROM `clanfight_memb` WHERE `user` = ".$user[id]);
$time = time();
mysql_query("INSERT INTO `clan_journal`(`cl_id`,`text`,`time`)VALUES('$clan[id]','<a href=/user/$user[id]>$user[login]</a> покинул клан','$time')");
header('location: /clans/');
exit;
}
?>
<div class='menuList'>
<?
if($clan['id'] == $i['id'] && $clan_memb['rank'] == 4 OR $clan_memb['rank'] == 5) {
?>
<li><a href='/clan/info/'><img src='/images/icon/arrow.png'> О клане</a></li>
<li><a href='/clan/<?=($_GET['adm'] == true ? '':'?adm=true')?>' <?=($_GET['adm'] == true ? 'style="color:#999;"':'')?>><img src='/images/icon/arrow.png' alt='*'/> <?=($_GET['adm'] == true ? 'Скрыть управление':'Управление кланом')?></a></li>
</div></div>
<div class='main'>
<div class='menuList'>
<?
}
if($clan_memb['rank'] == 5){
?>
<li><a href='/clan/deleteclan'><img src='/images/icon/arrow.png'> Распустить клан</a></li>
<?}?>
<li><a href='/clan/?exit'><img src='/images/icon/arrow.png' alt='*'/> Покинуть клан</a></li>
<?
}
?>
<?
if($clan['id'] == $i['id']){
if($clan_memb['rank'] == 4 OR $clan_memb['rank'] == 5){
?>
<div class='mini-line'></div>
<div class='block_zero'>
<div class='main'>
<div class='menuList'>
<?
if($_POST['change_rank_for_delete']) {
if (isset($_SESSION['msg'])){
echo "<div class='god4'><center>$_SESSION[msg]</center></div>";
$_SESSION['msg']=NULL;}
$rank = _string(_num($_POST['rank']));
mysql_query('UPDATE `clans` SET `rank_for_delete` = "'.$rank.'" WHERE `id` = "'.$clan['id'].'"');
$_SESSION['msg'] = '<img src="/images/icon/ok.png"> <font color="lightblue">Настройка успешно изменена.</font>';
}
$i_clan_memb = mysql_query('SELECT * FROM `clans` WHERE `id` = "'.$clan['id'].'"');
$i_clan_memb = mysql_fetch_array($i_clan_memb);
switch($i_clan_memb['rank_for_delete']) {
case 0:
$rank = 'Новобранцы';
break;
case 1:
$rank = 'Бойцы';
break;
case 2:
$rank = 'Офицеры';
break;
case 3:
$rank = 'Генералы';
break;
case 4:
$rank = '<font color="yellow">Зам лидера</font>';
break;
case 5:
$rank = '<font color='#3c3'>Лидер клана</font>';
break;
}
?>
Текущий звания: <span class='blue'><?=$rank;?></span><br/><br/>
Удолять из клана может:<br/>
<form action='/clan/' method='post'>
<select name='rank'>
<option value='0'>Новобранец</option>
<option value='1'>Боец</option>
<option value='2'>Офицер</option>
<option value='3'>Генерал</option>
<option value='4'>Зам. лидера</option>
<option value='5'>Лидер клана</option>
</select><br/>
<span class='btn'><span class='end'> <input class='label'type='submit' value='Сохранить' name='change_rank_for_delete'/>Сохранить</span></span>
</form>
</div>
<div class='mini-line'></div>
<div class='block_zero'>
<?
if($_POST['change_rank_for_invite']) {
if (isset($_SESSION['msg'])){
echo "<div class='god4'><center>$_SESSION[msg]</center></div>";
$_SESSION['msg']=NULL;}
$rank = _string(_num($_POST['rank']));
mysql_query('UPDATE `clans` SET `rank_for_invite` = "'.$rank.'" WHERE `id` = "'.$clan['id'].'"');
$_SESSION['msg'] = '<img src="/images/icon/ok.png"> <font color="lightblue">Настройка успешно изменена.</font>';
}
?>
Приглошать в клан может:<br/>
<form action='/clan/' method='post'>
<select name='rank'>
<option value='0'>Новобранец</option>
<option value='1'>Боец</option>
<option value='2'>Офицер</option>
<option value='3'>Генерал</option>
<option value='4'>Зам. лидера</option>
<option value='5'>Лидер клана</option>
</select><br/>
<span class='btn'><span class='end'> <input class='label'type='submit' value='Сохранить' name='change_rank_for_invite'/>Сохранить</span></span>
</form>
</div>
<div class='mini-line'></div>
<div class='block_zero'>
<?
if($_POST['change_name']) {
if($clan['g'] < 500) {
header('location: /clan/');
exit;
}
$name = _string($_POST['name']);
if($name) {
mysql_query('UPDATE `clans` SET `g` = `g` - 500,
`name` = "'.$name.'" WHERE `id` = "'.$clan['id'].'"');
$time = time();
mysql_query("INSERT INTO `clan_journal`(`cl_id`,`text`,`time`)VALUES('$clan[id]','Лидер сменил название клана','$time')");
}
header('location: /clan/');
}
?>
<form action='/clan/?change_name=true' method='post'>
Новое название:<br/>
<input type='text' class='text' name='name'/> <br/>
<span class='btn'><span class='end'> <input class='label'type='submit' value='Сохранить' name='change_name'/>Сохранить</span></span>
</form>
</div>
</div>
</div>
<?
}}
include './system/f.php';
break;
case 'money':
$title = 'Казна клана';
include './system/h.php';
if(!$clan['id'] OR $clan['id'] != $i['id']) {
header('location: /clan/');
exit;
}
$g = _string(_num($_POST['g']));
$s = _string(_num($_POST['s']));
if($g OR $s) {
if(($g >= 0) && ($g < 1000000)){
if($g && $user['g'] >= $g) {
if($user['level'] > 20) {
mysql_query('UPDATE `clans` SET `g` = `g` + '.$g.' WHERE `id` = "'.$clan['id'].'"');
mysql_query('UPDATE `users` SET `g` = `g` - '.$g.' WHERE `id` = "'.$user['id'].'"');
}
}
}else{
header('location: /clan_error.php');
exit;
}
if(($s >= 0) && ($s <100000000)){
if($s && $user['s'] >= $s) {
if($user['level'] > 20) {
mysql_query('UPDATE `clans` SET `s` = `s` + '.$s.' WHERE `id` = "'.$clan['id'].'"');
mysql_query('UPDATE `users` SET `s` = `s` - '.$s.' WHERE `id` = "'.$user['id'].'"');
}
}
}else{
header('location: /clan_error.php');
exit;
}
header('location: /clan/money/');
}
?>
<div class='main'>
<div class='block_zero'>
Казна клана: <img src='/images/icon/silver.png' alt='*'/> <?=n_f($i['s'])?> <img src='/images/icon/gold.png' alt='*'/> <?=n_f($i['g'])?><br/>
У вас на счету: <img src='/images/icon/silver.png' alt='*'/> <?=n_f($user['s'])?> <img src='/images/icon/gold.png' alt='*'/> <?=n_f($user['g'])?>
<div class='block_zero'>
<form action='/clan/money/' method='post'>
<img src='/images/icon/gold.png' alt='*'/> <input type='text' class='text' name='g' value='0'/><br/>
<img src='/images/icon/silver.png' alt='*'/> <input type='text' class='text' name='s' min='1' value='0'/><br/>
<span class='btn'><span class='end'><input class='label' type='submit' value='Пополнить'/>Пополнить</span></span>
</form></br>
• Пополнение казны только с 21 уровня!!!
</div>
</div>
<?
include './system/f.php';
break;
case 'memb':
if(!$clan['id'] OR $clan['id'] == $i['id'] && $clan_memb['rank'] < 3) {
header('location: /clan/');
exit;
}
$memb = _string(_num($_GET['memb']));
$memb = mysql_query('SELECT * FROM `clan_memb` WHERE `clan` = "'.$clan['id'].'" AND `id` = "'.$memb.'"');
$memb = mysql_fetch_array($memb);
if(!$memb) {
header('location: /clan/');
exit;
}
$memb_user = mysql_query('SELECT * FROM `users` WHERE `id` = "'.$memb['user'].'"');
$memb_user = mysql_fetch_array($memb_user);
$title = $memb_user['login'];
include './system/h.php';
if($memb['rank'] != 4 && $memb['rank'] < $clan_memb['rank']) {
if($_GET['up'] == true) {
mysql_query('UPDATE `clan_memb` SET `rank` = "'.($memb['rank'] + 1).'" WHERE `clan` = "'.$clan['id'].'" AND `id` = "'.$memb['id'].'"');
$time = time();
mysql_query("INSERT INTO `clan_journal`(`cl_id`,`text`,`time`)VALUES('$clan[id]','<a href=/user/$user[id]>$user[login]</a> повысил <a href=/user/$memb_user[id]>$memb_user[login]</a>','$time')");
header('location: /clan/memb/'.$memb['id'].'/');
}
}
if($memb['rank'] < $clan_memb['rank'] && $memb['rank'] > 0) {
if($_GET['down'] == true) {
mysql_query('UPDATE `clan_memb` SET `rank` = "'.($memb['rank'] - 1).'" WHERE `clan` = "'.$clan['id'].'" AND `id` = "'.$memb['id'].'"');
$time = time();
mysql_query("INSERT INTO `clan_journal`(`cl_id`,`text`,`time`)VALUES('$clan[id]','<a href=/user/$user[id]>$user[login]</a> понизил <a href=/user/$memb_user[id]>$memb_user[login]</a>','$time')");
header('location: /clan/memb/'.$memb['id'].'/');
}
}
?>
<div class='main'>
<div class='block_zero'>
<?
switch($memb['rank']) {
case 0:
$rank = 'Новобранец';
break;
case 1:
$rank = 'Боец';
break;
case 2:
$rank = 'Офицер';
break;
case 3:
$rank = 'Генерал';
break;
case 4:
$rank = '<font color='#95b9c7'>Зам. лидера</font>';
break;
case 5:
$rank = '<font color='#3c3'>Лидер клана</font>';
break;
}
?>
Звание: <?=$rank?><br/>
<img src='/images/icon/exp.png' alt='*'/> Опыт: <?=n_f($memb['exp'])?><br/>
<img src='/images/icon/gold.png' alt='*'/> <?=n_f($memb['g'])?><br/>
<img src='/images/icon/silver.png' alt='*'/> <?=n_f($memb['s'])?><br/>
Дата вступления: <?=date('d.m.y', $memb['time'])?>
</div>
<div class='mini-line'></div>
<div class='block_zero' align='center'>
<?
$cvc = mysql_fetch_array(mysql_query("SELECT * FROM `clan_memb` WHERE `clan` = '".$i['id']."' AND `rank` = '4'"));
if(!$cvc){
if($memb['rank'] != 4 && $memb['rank'] < $clan_memb['rank']) {
?>
<a href='/clan/memb/<?=$memb['id']?>/?up=true' class='btn'><span class='end'><span class='label'>Повысить</a></span></span>
<?
}
}else{
if($memb['rank'] != 3 && $memb['rank'] < $clan_memb['rank']) {
?>
<a href='/clan/memb/<?=$memb['id']?>/?up=true' class='btn'><span class='end'><span class='label'>Повысить</a></span></span>
<?
}}
if($memb['rank'] < $clan_memb['rank'] && $memb['rank'] > 0) {
?>
<a href='/clan/memb/<?=$memb['id']?>/?down=true' class='btn'><span class='end'><span class='label'>Понизить</a></span></span>
<?
}
?>
</div>
</div>
<?
if($clan_memb['rank'] == 5) {
if($_GET['lider'] == true) {
mysql_query('UPDATE `clan_memb` SET `rank` = "5" WHERE `id` = "'.$memb['id'].'"');
mysql_query('UPDATE `clan_memb` SET `rank` = "0" WHERE `user` = "'.$user['id'].'"');
header('location: /clan/');
}
?>
<div class='mini-line'></div>
<div class='block_zero' align='center'>
<center> <a href='/clan/memb/<?=$memb['id']?>/?lider=true' class='btn'><span class='end'><span class='label'>Передать лидерство</a></span></span>
</div>
<?
}
if($memb['rank'] < $clan_memb['rank'] && $clan_memb['rank'] >= $clan['rank_for_delete']) {
if($_GET['delete'] == true) {
mysql_query('DELETE FROM `clan_memb` WHERE `id` = "'.$memb['id'].'"');
mysql_query("DELETE FROM `clanfight_memb` WHERE `user` = ".$memb[user]);
$time = time();
mysql_query("INSERT INTO `clan_journal`(`cl_id`,`text`,`time`)VALUES('$clan[id]','<a href=/user/$user[id]>$user[login]</a> исключил <a href=/user/$memb_user[id]>$memb_user[login]</a>','$time')");
$read = '1';
$to = $memb_user['id'];
$from = '2';
$text = 'Вы покинули или были исключены из клана <a href="/clan/'.$clan["id"].'"><img src="/images/icon/race/'.$clan["r"].'.png">'.$clan["name"].'</a>"';
mysql_query("INSERT INTO `mail` SET `from` = '$from',`time` = '$time',`to`='$to',`text` = '$text'");
header('location: /clan/');
}
?>
<div class='mini-line'></div>
<div class='block_zero' align='center'>
<a href='/clan/memb/<?=$memb['id']?>/?delete=true' class='btn'><span class='end'><span class='label'>Исключить</a></span></span>
</div>
</div>
<?
}
include './system/f.php';
break;
case 'built':
$title = 'Статуя клана';
include './system/h.php';
if (isset($_SESSION['msg'])){
echo "<div class='block center'><center>$_SESSION[msg]</center></div>";
$_SESSION['msg']=NULL;}
if(!$clan['id'] OR $clan['id'] != $i['id']) {
header('location: /clan/');
exit;}
$progress = round(100 / (34 / $i['built_1']));
function cost($i) {
switch($i) {
case 0:
$cost = 1000000;
break;
case 1:
$cost = 1000000;
break;
case 2:
$cost = 5000;
break;
case 3:
$cost = 3000000;
break;
case 4:
$cost = 6000;
break;
case 5:
$cost = 5000000;
break;
case 6:
$cost = 6000000;
break;
case 7:
$cost = 7500000;
break;
case 8:
$cost = 7000;
break;
case 9:
$cost = 7500000;
break;
case 10:
$cost = 8500000;
break;
case 11:
$cost = 8590000;
break;
case 12:
$cost = 10000;
break;
case 13:
$cost = 8700000;
break;
case 14:
$cost = 9790000;
break;
case 15:
$cost = 13890000;
break;
case 16:
$cost = 20000;
break;
case 17:
$cost = 13900000;
break;
case 18:
$cost = 13500000;
break;
case 19:
$cost = 13500000;
break;
case 20:
$cost = 30000;
break;
case 21:
$cost = 14000000;
break;
case 22:
$cost = 14090000;
break;
case 23:
$cost = 14090000;
break;
case 24:
$cost = 40000;
break;
case 25:
$cost = 23190000;
break;
case 26:
$cost = 24000000;
break;
case 27:
$cost = 25900000;
break;
case 28:
$cost = 50000;
break;
case 29:
$cost = 44900000;
break;
case 30:
$cost = 44900000;
break;
case 31:
$cost = 70000;
break;
case 32:
$cost = 46900000;
break;
case 33:
$cost = 47000000;
break;
case 34:
$cost = 50000000;
break;
case 35:
$cost = 55000000;
break;
case 36:
$cost = 60000000;
break;
case 37:
$cost = 63000000;
break;
case 38:
$cost = 67000000;
break;
case 39:
$cost = 73000000;
break;
case 40:
$cost = 100000;
break;
case 41:
$cost = 75000000;
break;
case 42:
$cost = 80000000;
break;
case 43:
$cost = 85000000;
break;
case 44:
$cost = 88000000;
break;
case 45:
$cost = 90000000;
break;
case 46:
$cost = 93000000;
break;
case 47:
$cost = 95000000;
break;
case 48:
$cost = 10000000;
break;
case 49:
$cost = 15600000;
break;
case 50:
$cost = 1780000;
break;
case 51:
$cost = 19800000;
break;
}
return $cost;}
function value($i) {
switch($i) {
case 0:
$value = 0;
break;
case 1:
$value = 0;
break;
case 2:
$value = 0;
break;
case 3:
$value = 0;
break;
case 4:
$value = 1;
break;
case 5:
$value = 0;
break;
case 6:
$value = 0;
break;
case 7:
$value = 0;
break;
case 8:
$value = 1;
break;
case 9:
$value = 0;
break;
case 10:
$value = 0;
break;
case 11:
$value = 0;
break;
case 12:
$value = 1;
break;
case 13:
$value = 0;
break;
case 14:
$value = 0;
break;
case 15:
$value = 0;
break;
case 16:
$value = 1;
break;
case 17:
$value = 0;
break;
case 18:
$value = 0;
break;
case 19:
$value = 0;
break;
case 20:
$value = 1;
break;
case 21:
$value = 0;
break;
case 22:
$value = 0;
break;
case 23:
$value = 0;
break;
case 24:
$value = 1;
break;
case 25:
$value = 0;
break;
case 26:
$value = 0;
break;
case 27:
$value = 0;
break;
case 28:
$value = 1;
break;
case 29:
$value = 0;
break;
case 30:
$value = 0;
break;
case 31:
$value = 1;
break;
case 32:
$value = 0;
break;
case 33:
$value = 0;
break;
case 34:
$value = 0;
break;
case 35:
$value = 0;
break;
case 36:
$value = 0;
break;
case 37:
$value = 0;
break;
case 38:
$value = 0;
break;
case 39:
$value = 0;
break;
case 40:
$value = 1;
break;
case 41:
$value = 0;
break;
case 42:
$value = 0;
break;
case 43:
$value = 0;
break;
case 44:
$value = 0;
break;
case 45:
$value = 0;
break;
case 46:
$value = 0;
break;
case 47:
$value = 0;
break;
case 48:
$value = 0;
break;
case 49:
$value = 0;
break;
case 50:
$value = 1;
break;
case 51:
$value = 1;
break;
}
return $value;}
?>
<div class='center'><div class='block_zero'><img src='/images/clanstatue.jpg' width='100%' alt=''/></div></div><div class='mini-line'>
<div class='god4'>
<img src="/images/icon/clan/building.png" alt="" style="float:left;margin-right:3px;margin-top:3px;">
<div style="display:inline-block;">
<img src='/images/icon/clan.png' alt='*'/> <b>Статуя клана:</b> <img src='/images/icon/level.png' alt='*'/> <?=$i['built_1']?> уровень<br/>
<?
if($i['built_1'] > 0) {
?>
Бонус: <font color='#90c090'>+<?=clan_buff($i['built_1'])?></font> к сумме параметров<br/><?}?>
<font color='#90b0c0'>Прогресс:</font> <?=$progress?>%
</div><br/>
<div class="bgpbar" style="margin:0;"><div class="yellowpbar" style="height:5px;width:<?=$progress;?>%"></div></div>
<?
if($i['id'] == $clan['id'] && $clan_memb['rank'] > 3 && $i['built_1'] < 50) {
if($_GET['up'] == true) {
if($i[(value($i['built_1']) == 1 ? 'g':'s')] < cost($i['built_1'])) {
$_SESSION['err'] = '<img src="/images/icon/error.png">Что то пошло не так.';
header('location: /clan/built/');
exit();
}else{
mysql_query('UPDATE `clans` SET `built_1` = `built_1` + 1, `'.(value($i['built_1']) == 1 ? 'g':'s').'` = `'.(value($i['built_1']) == 1 ? 'g':'s').'` - '.cost($i['built_1']).' WHERE `id` = "'.$i['id'].'"');
mysql_query('INSERT INTO `clan_journal` (`clan`,`text`,`close`,`time`) VALUES ("'.$clan['id'].'","<img src=/images/icon/race/'.$user['r'].'.png> '.$user['login'].' улучшил <span class=blue>клановую постройку</span> и поднял на '.$i['built_1'].' уровень.","1","'.time().'")');
$_SESSION['not'] = '<img src="/images/icon/ok.png"> Статуи клана успешно прокачен.';
header('location: /clan/built/');
}}
?></div>
<div class="god3 center"><div class="link_center">
<center><a href='/clan/built/?up=true' class='btn'><span class='end'><span class='label'>Улучшить <img src='/images/icon/<?=(value($i['built_1']) == 1 ? 'gold':'silver')?>.png' alt= '*' /> <?=cost($i['built_1'])?></a></center>
</div></div></div><div class='hr'></div>
<?
}
//
if($i['id'] == $clan['id'] && $clan_memb['rank'] > 3) {
if($_GET['done'] == true) {
// error_get_last
if($i['built_2_time'] > time()) {
$_SESSION['err'] = '<img src="/images/icon/error.png">Что то пошло не так.';
header('location: /clan/');
exit;
}
$_cost_done = 5000;
if($i['g'] < $_cost_done){
$_SESSION['err'] = 'В вашем казне не хватает <img src='/images/icon/gold.png' alt='*'/> '.($_cost_done - $i['g']).' золота';
header('location: /clan/built/');
exit();
}else{
mysql_query('INSERT INTO `clan_journal` (`clan`,`text`,`close`,`time`) VALUES ("'.$clan['id'].'","<img src=/images/icon/race/'.$user['r'].'.png> '.$user['login'].' активировал <span class=dgreen>Бонус клана</span>","1","'.time().'")');
mysql_query('UPDATE `clans` SET `g` = "'.($i['g'] - $_cost_done).'", `built_2_time`= "'.(time()+(86400)).'" WHERE `id` = "'.$i['id'].'"');
mysql_query('update `users` set `str`=`str`+'.clan_buff($i['built_1']).',`agi`=`agi`+'.clan_buff($i['built_1']).', `vit`=`vit`+'.clan_buff($i['built_1']).', `def`=`def`+'.clan_buff($i['built_1']).', `mana`=`mana`+'.clan_buff($i['built_1']).' where `clan` = "'.$user['clan'].'"');
header('location: /clan/built/');
exit;
}}}
?>
</div></div></div>
<div class='mini-line'>
<div class='main'>
<div class='menuList'>
<center><img src='/images/icon/clan.png' alt='*'/> <b>Клановый бонус:</b><br />
Бонус: <font color='#90c090'>+<?=clan_buff($i['built_1'])?></font> к сумме параметров<br/>
<font color='#90b0c0'>Информация:</font> после активации лидером <font color='#90c090'>"Клановый бонус"</font>, все игроки получат +<?=clan_buff($i['built_1'])?> к сумме параметров</font>
<br/>
<font color='red'>Примечание: 5000<img src="/images/icon/gold.png"> золота с казны.</font><br/><br/>
</div></div><div class="hr"></div>
<?
if($i['built_2_time'] > time()) {
?>
<div class='main'>
<div class='menuList'>
<center> Действует: <?=_time($i['built_2_time'] - time())?></center>
</div><div class="hr"></div>
<?
}elseif($clan_memb['rank'] > 3){
?>
<div class="god3 center"><div class="link_center"><div class='main'>
<div class='menuList'>
<a href='/clan/built/?done=true' class='btn'><span class='end'><span class='label'>Активировать <img src='/images/icon/gold.png' alt= '*' /> 5000 </a>
</div></div>
<?
}
?>
</div>
<?
include './system/f.php';
break;
case 'deleteclan':
$title = 'Распустить клан';
include './system/h.php';
if(!$clan['id'] OR $clan['id'] != $i['id']) {
header('location: /clan/');
exit;
}
if(isset($_GET['no'])){
header('location:/clan');
}
if(isset($_GET['yes'])){
if($clan_memb['rank'] == 5) {
mysql_query("UPDATE `users` SET `g` = `g` + 1000 WHERE `id` = '$user[id]'");
mysql_query("DELETE FROM `clans` WHERE `id` = '$clan[id]'");
header('location:/clans');
mysql_query("DELETE FROM `clan_memb` WHERE `clan` = '$clan[id]'");
mysql_query("DELETE FROM `clanfight_memb` WHERE `clan` = ".$clan[id]);
}
}
?>
<div class='main'><div class='center'><div class='block_zero'><img src='http://tiwar.ru/images/town/hd/clanstatue.jpg' width='100%' alt=''/></div></div>
<div class='mini-line'></div>
<small>Вы действительно хотите распустить клан?<br/>
- Мы вернем вам <span class='dgreen'>50%</span> золота от стартовой суммы.</small>
<div class='mini-line'></div>
<center><a class='btn' href='?yes'><span class='end'><span class='label'>Да</span></span></a><a class='btn' href='?no'><span class='end'><span class='label'>Нет</span></span></a>
</div>
<?
include './system/f.php';
break;
case 'gerb':
$title = 'Герб клана';
if($clan['id'] == 0 || $clan_memb['rank'] < 5){
header("Location: /");
exit;
}
include './system/h.php';
$error = NULL;
if(isset($_POST['id'])) {
$id = _num($_POST['id']);
if($id > 1 || $id < 16) {
$z = 0;
$se = 0;
mysql_query("UPDATE `clans` SET `gerb` = '".$id."' WHERE `id` = '".$clan['id']."'");
mysql_query("UPDATE `clans` SET `g` = `g` - '".$z."' WHERE `id` = '".$clan['id']."'");
mysql_query("UPDATE `clans` SET `s`= `s` - '".$se."' WHERE `id` = '".$clan['id']."'");
$time = time();
mysql_query("INSERT INTO `clan_journal`(`cl_id`,`text`,`time`)VALUES('$clan[id]','<a href=/user/$user[id]>$user[login]</a> сменил герб клана','$time')");
header("Location: /clan/");
exit();
}
}
if($error) {
echo '<div class="main" style="color: red">
'.$error.'
</div>';
}
echo '<div class="main">
<div class="mini-line"></div>
<form class="main" method="post" action="">
Выбрать клановый герб:<br />';
for($i = 1; $i < 16; $i++) {
echo '<div class="main">';
echo '<input type="radio" name="id" value="'.$i.'" />
<img src="/images/icon/clan/gerb/'.$i.'.png" /><br/>';
echo '</div><div class="mini-line"></div>';
}
echo '
<div class="main"/>
<span class="btn"><span class="end"><input class="label" type="submit" value="Отправить"></span></span>
</form>
<div class="mini-line"></div>
<div class="grey"><small>
</div></div></small>
</div>';
include './system/f.php';
break;
case 'info':
$title = 'О клане';
include './system/h.php';
if(isset($_GET['edit'])){
$infa = htmlspecialchars(trim(mysql_real_escape_string($_POST['infa'])));
mysql_query("UPDATE `clans` SET `infa` = '".$infa."' WHERE `id` = '".$clan['id']."'");
header('location: /clan/');
}
$u = mysql_query("SELECT * FROM `clans` WHERE `id` = '".$clan['id']."'");
while($u1 = mysql_fetch_assoc($u)){
?>
<div class="main">
<div class="block_zero">
<form action="?edit" method="post">
О клане: <br>
<input class="text medium-text" name="infa" maxlength="150" value="<?=$u1['infa']?>" type="text"><br>
<span class="btn"><span class="end"><input class="label" name="edit" value="Сохранить" type="submit">Сохранить</span></span>
</form>
</div>
</div>
</div>
<?
}
include './system/f.php';
break;
case 'gold':
include './system/h.php';
$clan_g = mysql_query("SELECT * FROM `clan_memb` WHERE `clan` = '".$clan['id']."' ORDER BY `g` DESC LIMIT 10")or die(mysql_error());
while($row = mysql_fetch_array($clan_g)){
$us = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '".$row['user']."'"));
?>
<?=$us['login']?> - <?=$row['g']?><br>
<?
}
include './system/f.php';
break;
case 'silver':
include './system/h.php';
$clan_g = mysql_query("SELECT * FROM `clan_memb` WHERE `clan` = '".$clan['id']."' ORDER BY `s` DESC LIMIT 10");
while($row = mysql_fetch_array($clan_g)){
$us = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '".$row['user']."'"));
?>
<?=$us['login']?> - <?=$row['s']?><br>
<?
}
include './system/f.php';
break;
case 'clan_tur':
include './system/h.php';
?>
<?
include './system/f.php';
break;
case 'clan_tur_reit':
include './system/h.php';
$clan_g = mysql_query("SELECT * FROM `clan_memb` WHERE `clan` = '".$clan['id']."' ORDER BY `dobl` DESC LIMIT 10");
?>
<div class="bdr cnr bg_blue mb2 bl nd"><div class="wr1"><div class="wr2"><div class="wr3"><div class="wr4"><div class="wr5"><div class="wr6"><div class="wr7"><div class="wr8"> <div class="ml10 mt5 mr10 mb5 cntr"> <div class="medium win tdn bold mb10">Турнир по доблести</div> <span class="lorange">Ваш уровень доблести:</span> <span class="lyell"><img class="icon" height="20" src="https://static.mrush.mobi/view/image/icons/up_valor.png" />0</span> <div class="mb5"></div> <span class="lorange">Доблесть вашего клана:</span> <span class="lyell"><img class="icon" height="20" src="https://static.mrush.mobi/view/image/icons/up_valor.png" /><?=$clan['dobl']?></span> </div> <div class="ml10 mt5 mr10 mb10 lorange cntr"> </div>
<div class="mb5"> <table class="cntr wa mlra"> <tr> <td class="p5">Место</td> <td class="p5">Имя</td> <td class="p5">Рейтинг</td> </tr>
<?
$sort = _string($_GET['sort']);
$max = 10;
$count = mysql_result(mysql_query('SELECT COUNT(*) FROM `clan_memb` WHERE `clan` = "'.$clan['id'].'"'),0);
$pages = ceil($count/$max);
$page = _string(_num($_GET['page']));
if($page > $pages) {
$page = $pages;
}
if($page < 1) {
$page = 1;
}
$start = $page * $max - $max;
if($page == 1) {
$i = $page - 1;
}
elseif($page == 2) {
$i = ($page + 9);
}
else
{
$i = ($page * 10) - 9;
}
if($count > 0) {
$q = mysql_query('SELECT * FROM `clan_memb` WHERE `clan` = "'.$clan['id'].'" ORDER BY `dobl` DESC,`dobl` DESC LIMIT '.$start.', '.$max.'');
while($row = mysql_fetch_array($q)) {
$memb = mysql_query('SELECT * FROM `users` WHERE `id` = "'.$row['user'].'"');
$memb = mysql_fetch_array($memb);
$i++;
?>
<tr> <td class="yell"><?=$i?></td> <td class="">
<a href="/user/<?=$memb['id']?>" class="lwhite p5"> <?=$memb['login']?>
</a> </td> <td class="yell"><?=$row['dobl']?></td> <tr> <tr> <?}}?>
<tr> </table>
<div class="pgn mt5"><?=pages('/clan/?action=clan_tur_reit')?> </div> </div>
<div class="clb"></div></div></div></div></div></div></div></div></div></div>
<div class="hr_g mb2"><div><div></div></div></div><div class="bntf"><div class="nl"><div class="nr cntr lyell lh1 pb5 sh"><span class="small"> В клане учитываются уровни доблести, полученные игроком после испытательного срока.</span></div></div></div>
<div class="hr_g mb2"><div><div></div></div></div><a class="mbtn mb2" href="/clan_tournament"><img class="icon" src="https://static.mrush.mobi/view/image/icons/back.png" /> Назад</a><div class="hr_g mb2"><div><div></div></div></div>
<?
include './system/f.php';
break;
}
?>