Файл: public_html/clan2.php
Строк: 917
<?
include './system/common.php';
include './system/functions.php';
include './system/user.php';
if(!$user) {header('location: /');exit;}
$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);
$cln = mysql_query('SELECT * FROM `clan_memb` WHERE `clan` = "'.$id.'"');
$cln = mysql_fetch_array($cln);
if(!$i) {header('location: /clans/');exit;}
switch($_GET['action']) {
default:
$title = 'Клан "'.$i['name'].'"';
include './system/h.php';
?>
<div class="title2">Клан</div>
<?
$_exp = round(100 / (clan_exp($i['level']) / $i['exp']));
if($_exp > 100) {$_exp = 100;}
?>
<div class="gide1"><div class="gide2"><div class="gide3"><div class="gide4"><div class="gide_bg center"><img src='/images/icon/clan/<?=$i['r']?>.png' alt=''*/><span class="white"> <?=$i['name']?>, <img src='/images/icon/level.png'/><?=$i['level']?> ур.</span></div></div></div></div></div>
<div class='god4'>
<span class='vmz'>
<table style="width:0px;" cellpadding='0' cellspacing='0'><tr>
<td>
<?if($clan && $clan['id'] == $i['id'] && $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) {?></a>
<?}?>
</td><td valign='top' style='padding-left: 5px;'>
<img src='/images/icon/exp.png' alt='*'/> Опыт: <?=n_f($i['exp'])?> / <?=n_f(clan_exp($i['level']))?> <font color='#999'>(<?=$_exp?>%)</font>
<div class="bgpbar" style="width:45%;margin:0px;"><div class="yellowpbar" style="height:5px;width:<?=$_exp?>%"></div></div><br/>
<?
echo 'О клане: ';
echo (empty($i['info'])?'Не заполнено':''.bb($i['info']).'');
echo '<br/>Основан: ';
echo (empty($cln['time'])?'Не известно':''.vremja($cln['time']).'');
?></td>
</tr></table>
</span>
</div>
<div class='hr'></div>
<?
$build = mysql_fetch_array(mysql_query('SELECT * FROM `build` WHERE `clan` = '.$clan['id'].''));
if($clan['id'] == $i['id']) {
if($c_m['start'] == 1 AND $user['mob'] == 1 AND $clan){
echo'<div class="god3 center">
<img src="/images/icon/boy.png"><span class="gray">Проклятая пещера</span><img src="/images/icon/boy.png"><br/>
<span class="gray">До конца осталось:</span> <font color="gren">'.$time_clan_m.'</font><br/>
<div class="link_center">
<a href="/clan_mob.php">Перейти к сражению</a>
</div></div>
</div>';
}elseif($c_m['start'] == 1 AND $user['mob'] == 0){
echo'<div class="god3 center">
<img src="/images/icon/boy.png"><span class="gray">Проклятая пещера</span><img src="/images/icon/boy.png"><br/>
<span class="gray">До конца осталось:</span> <font color="gren">'.$time_clan_m.'</font><br/>
<div class="link_center">
<a href="/clan_mob.php">Перейти к сражению</a>
</div></div>';}
?>
<div class='block_link light_bottom'>
<a class='white' href='/clan/built/'><img src="/images/icon/clan/building.png" alt="" height="30px" width="30px" style="float:left;margin-top:3px;"> <img src='/images/icon/clan.png' alt='*'/> Клановые постройки <br/>
<?=($clan['built_1'] > 0 ? '<span class="lime">+'.$clan_buff.'</span> к параметрам':'<span class=vmz><font color=grey>Не прокачан</font></span>')?></span></a>
</div><div class='hr'></div>
<div class='block_link light_bottom'>
<a class='white' href='/clan/kazn/'><img src="/images/icon/clan/chest.png" alt="" height="30px" width="30px" style="float:left;margin-top:3px;"><img src="/images/gold.png" alt=""> Казна клана: <br/>
<img src='/images/sera.png' alt='*'/><?=n_f($clan['s'])?> <img src='/images/gold.png' alt='*'/><?=n_f($clan['g'])?> <img src="/images/kris.png"><?=n_f($clan['kris'])?></a>
</div><div class='hr'></div>
<div class='block_link light_bottom'>
<a class="white" href="quest.php"><img src="/images/gifts/19.png" height="30px" width="30px" style="float:left;margin-top:3px;"/><img src="/images/icon/quest.png" /> Клановые задания<br/>
<font color="lime">Ежедневные квесты</font></a>
</div><div class='hr'></div>
<div class='block_link light_bottom'>
<a class="white" href="/clan_fight.php"><img src="/images/gifts/53.png" height="30px" width="30px" style="float:left;margin-top:3px;"/><img src="/images/icon/quest.png" /> Клановая схватка<br/>
<span style="padding:5px" class="vmz"> <font color="lime">Клан между клана и клан против моба </b></font></span></a></li>
</div><div class='hr'></div>
<?
$_chat = mysql_query('SELECT COUNT(*) FROM `chat` WHERE `clan` = "'.$clan['id'].'" AND `to` = "'.$user['id'].'" AND `read` = "0"');
$_chat = mysql_result($_chat,0);
?>
<div class="god4 center"><div class="hz_menu">
<a href='/clan/forum/'><img src="/images/icon/section.png" alt="*"> Форум </a>
<a href='/clan_z.php'><img src="/images/icon/section.png" alt="*"> Заявки в клан <?=mysql_result(mysql_query('SELECT COUNT(*) FROM `clan_z` WHERE `clan` = "'.$clan['id'].'"'),0) > 0 ? '<small><font color='#30c030'>(+)</font></small>':''?> </a>
<a href='/clan/journal/'><img src='/images/icon/section.png'> Журнал <?=(mysql_result(mysql_query('SELECT COUNT(*) FROM `clan_journal` WHERE `clan` = "'.$clan['id'].'" AND `new` = "1"'),0) > 0 ? '<small><font color='#30c030'>(+)</font></small>':'')?></a>
<a href='/chat/clan/'><img src='/images/icon/chat.png' alt='*'/> Чат <?=($_chat > 0 ? '<font color='#3c3'><small>(+)</small></font>':'')?></a>
<?if($clan['id'] == $i['id'] && $clan_memb['rank'] > 3) {?>
<a href='http://vozmezdiegeri.com/clan/adm/'><img src='/images/icon/premium.png'> Управление</a><?}?>
</div></div>
<?
$new_baby = mysql_query('SELECT * FROM `ass_br` WHERE `clan_id` = "'.$clan['id'].'" AND `time` > "'.(time()-((60*60)*24)).'" LIMIT 2');
$new_baby = mysql_fetch_array($new_baby);
if($new_baby > 0){
$q = mysql_query("SELECT * FROM `ass_br` WHERE `clan_id` = '".$user['clan']."' ORDER BY `time` DESC LIMIT 2");
while($row = mysql_fetch_array($q)) {
echo'<div class="god3">';
echo''.nick($row['avtor']).' ';
if(mb_strlen($row['msg']) > 200){$text = mb_substr(smiles(bb($row['msg'])),0,200);
echo ''.$text.'....<br/>';}else{echo ''.smiles(bb($row['msg'])).'';}
echo'</div><div class="hr"></div>';
}
}
?>
<?
}
$max = 10;
$count = mysql_result(mysql_query('SELECT COUNT(*) FROM `clan_memb` WHERE `clan` = "'.$i['id'].'"'),0);
$counts = mysql_result(mysql_query('SELECT COUNT(*) FROM `clan_memb` WHERE `clan` = "'.$i['id'].'" AND `online` > "'.(time() - 300).'"'),0);
$pages = ceil($count/$max);
$page = _string(_num($_GET['page']));
if($page > $pages) {
$page = $pages;}
if($page < 1) {
$page = 1;
}
$start = $page * $max - $max;
?>
<div class="god3 light_bottom center">
<span class="gray"> <b>Состав клана: (<?=$count?>) - В игре: (<?=$counts?>)</b></span><br>
</div>
<div class='god4 light_bottom'>
<?if($clan['id'] == $i['id'] && $clan_memb['rank'] > 3) {?>
<center><u><i><font color="grey"><a href='/clan/<?=($_GET['adm'] == true ? '':'?adm=true')?>' <?=($_GET['adm'] == true ? 'style="color:#999;"':'')?>> <?=($_GET['adm'] == true ? 'Отредактировать':'Редактировать')?></a>
</u></i></font></center><br/><br/><?}?>
<?
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="yellow">Маршал</font>';
break;
case 5:
$rank = '<font color='#3c3'>Лидер клана</font>';
break;
}
if($clan && $clan['id'] == $i['id'] && $row['user'] != $user['id'] && $clan_memb['rank'] > 3 && $_GET['adm'] == true) {
?>
<span style='float: left;'><a href='/clan/memb/<?=$row['id']?>/'><img src='/images/icon/settings.png' alt='*'/></a></span><?}?>
<?
/* Дизайн для мобильника */
?>
<?=nick($memb['id'])?> - <?=$rank?>
<span class="float-right"><span class="white"><?=n_f($row['exp'])?> <img src="/images/icon/xp.png" width="20"></span></span></a><br/>
<?
}
echo'</div>';
?>
<div class="god3" align="center"><span class='vmz'>
<?=pages('/clan/'.$i['id'].'/'.($_GET['adm'] == true ? '?adm=true&':'?'))?></span></div><div class="hr"></div>
<?
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'].')');
}
?>
<a class='link' href='?zay=1'>Подать заявку в клан</a>
<?
}else{
?>
<div class='block'>Вы уже подали заявку в клан!</div>
<?
}
}
?>
<?}else{}?>
<?
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">Да,выйти - <img src="/images/icon/gold.png">150</span></span></a></div><br/>
<a href="/clan/">Нет,передумал</a>';
echo '</center></div><div class="hr"></div>';}else{
}
if($_GET['exit'] == true && $user['g'] >= 150) {
mysql_query("UPDATE `users` SET `clan` = '0', `g` = '".($user['g']-150)."', `str` = '".($user['str']-$clan['param'])."', `def` = '".($user['def']-$clan['param'])."',`agi` = '".($user['agi']-$clan['param'])."', `vit` = '".($user['vit']-$clan['param'])."', `idol` = '".($user['idol']=0)."', `amulet` = '".($user['amulet']=0)."' WHERE `id` = '$user[id]'");
mysql_query('DELETE FROM `clan_memb` WHERE `clan` = "'.$clan['id'].'" AND `user` = "'.$user['id'].'"');
header('location: /');
}
if($clan_memb['rank'] != 5) {
?>
<div class="hr"></div>
<div class='god4 center'>
<div class='link_center'><a href='/clan/?exit'><img src='/images/icon/arrow.png' alt='*'/> Покинуть клан</a></div>
</div>
<?
}
}
include './system/f.php';
break;
case 'delete_rank':
$title = 'Настроить удаление клана';
include './system/h.php';
if($clan['id'] == $i['id'] && $clan_memb['rank'] > 3) {
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;
}
?>
<div class="title2">Настройка клана</div>
<div class='god4 center'>
Текущий звания: <span class='blue'><?=$rank;?></span><br/><br/>
Выбрать новую званию:<br/>
<form action='?' 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/><br/>
<input class='button' type='submit' value='Сохранить' name='change_rank_for_delete'/>
</form>
</div><div class='hr'></div>
<div class="god3">
<li>Здесь вы выбираете званию и люди в вашем клане с этим званием могут удалять людей с клана.</li>
</ul></div><div class='hr'></div>
<div class="god4 center"><div class="menu_link">
<a href='/clan/adm/'><img src="/images/icon/arrow.png"> Вернуться назад</a>
</div></div>
<?
}else { echo '<div class="block center"><br/> У вас нет права на эту страницу <br/><a href="/clan/">Вернутсья назад</a></div>'; }
include './system/f.php';
break;
case 'change_name':
$title = 'Изменить имя клана';
include './system/h.php';
if($clan['g'] < 15000) $errors[] = '<font color="red">Ошибка</font>, нехватает <img src='/images/icon/gold.png' alt='*'> '.(15000 - $clan['g']).' золота в казне клана';
if($errors) {
echo '<div class='god4' align='center'><br/>';
foreach($errors as $error) {
echo $error.'<br/>';
}
echo '</div><div class='hr'></div>';
}
else
{
if($_POST['change_name']) {
if (isset($_SESSION['msg'])){
echo "<div class='god4'><center>$_SESSION[msg]</center></div>";
$_SESSION['msg']=NULL;}
$name = _string($_POST['name']);
if($name) {
mysql_query('UPDATE `clans` SET `g` = `g` - 15000,
`name` = "'.$name.'" WHERE `id` = "'.$clan['id'].'"');
$errors[] = 'Успешно изменена';
}
}
}
?>
<div class="title2">Изменение имя клана</div>
<div class='god4 center'>
Текущий название: <span class='gray'><?=$clan['name']?></span><br/><br/>
<form action='?' method='post'>
Новое название:<br/>
<input class='text' type='text' name='name'/> <br/><input class='button' type='submit' value='Сохранить' name='change_name'/>
</form>
</div><div class='hr'></div>
<div class="god3">
Для изменение названия клана по требуется в казне клана <img src='/images/icon/gold.png'>15000 золотых монет.</li></ul>
</div><div class='hr'></div>
<div class="god4"><div class="menu_link">
<a href='/clan/adm/'><img src="/images/icon/arrow.png"> Вернуться назад</a>
</div></div>
<?
include './system/f.php';
break;
case 'invite':
$title = 'Настроить приглашение клана';
include './system/h.php';
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>';
}
?>
<div class="title2">Настройка клана</div>
<div class='god4 center'>
Приглашать в клан может:<br/>
<form action='/clan/invite/' 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/><br/>
<input class='button' type='submit' value='Сохранить' name='change_rank_for_invite'/>
</form></div><div class='hr'></div>
<div class="god4"><div class="menu_link">
<a href='/clan/adm/'><img src="/images/icon/arrow.png"> Вернуться назад</a>
</div></div>
<?
include './system/f.php';
break;
case 'desk':
$title = 'Объявить объявления клана';
include './system/h.php';
$text = _string($_POST['text']);
if(empty($text)) {
echo "
<div class='god4 center'>
<form action='/clan/desk/' method='post'>
Новое обьявление:<br/>
<textarea class='text medium-text' type='text' name='text'></textarea> <br>
<input class='button' type='submit' value='Отправить'/>
</form></div><div class='hr'></div>
<div class='god3'>ББ-коды(<font color='gray'><a href='/bb.php'>подробнее</a></font>)<br/>
</div><div class='hr'></div>
<div class='god4'><div class='menu_link'>
<a href='/clan/adm/'><img src='/images/icon/arrow.png'> Вернуться назад</a>
</div></div>
</div>
";}else{
mysql_query('INSERT INTO `clan_msg` (`clan`,`user`, `text`,`time`) VALUES ("'.$clan['id'].'", "'.$user['id'].'", "'.$text.'", "'.time().'")');
echo"<div class='block'><br/><br/>Обьявление размещено!";
echo"<br/><br/><a href="/clan/adm/">Продолжить</a></div></div><br/>";}
include './system/f.php';
break;
case 'info':
$title = 'Информация об клане';
include './system/h.php';
$text = _string($_POST['text']);
if(empty($text)) {
echo "
<div class='god4 center'><span class='vmz'>
<form action='/clan/info/' method='post'>
Информация о клане(мах 1000):<br/>
<textarea class='text medium-text' type='text' name='text'></textarea> <br>
<input class='button' type='submit' value='Отправить'/>
</form></div><div class='hr'></div>
<div class='god3'>ББ-коды(<font color='gray'><a href='/bb.php'>подробнее</a></font>)<br/>
</div><div class='hr'></div>
<div class='god4'><div class='menu_link'>
<a href='/clan/adm/'><img src='/images/icon/arrow.png'> Вернуться назад</a>
</div></div>
</div></span>
";}else{
mysql_query('update `clans` set `info` = "'.$text.'" Where `id` = "'.$user['clan'].'"');
echo"<div class='block'><br/><br/>Информация об клане было успешно размещено!";
echo"<br/><br/></div></div>
<a class='btn nav-btn' href="/clan/adm/">Продолжить</a><br/>";}
include './system/f.php';
break;
case 'delete':
$title = 'Удаление клана';
include './system/h.php';
$where_usr = mysql_result(mysql_query("SELECT COUNT(id) FROM `clan_memb` Where `clan` = '".$user['clan']."'"),0);
if($where_usr == 1 && $clan['id'] == $i['id'] && $clan_memb['rank'] == 5) {
echo'<div class="title2">Удаление клана</div>
<div class="god4 center">
<span class="gray">Вы решили удалить клан?</span><br/>
<div class="link_center">
<a href="?yeah_delete=true">Да,удалить</a>
</div></div>';
}
if($_GET['yeah_delete'] == true && $where_usr == 1) {
mysql_query('Delete from `clan_memb` where `user` = "'.$user['id'].'"');
mysql_query('Delete from `clans` where `id` = "'.$user['clan'].'"');
}
include './system/f.php';
break;
case 'adm':
$title = 'Панель управления клана';
include './system/h.php';
$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_invite']) {
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;}
$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:
$ranks = 'Новобранцы';
break;
case 1:
$ranks = 'Бойцы';
break;
case 2:
$ranks = 'Офицеры';
break;
case 3:
$ranks = 'Генералы';
break;
case 4:
$rank = '<font color="yellow">Маршал</font>';
break;
case 5:
$rank = '<font color='#3c3'>Лидер клана</font>';
break;}
if($clan['r'] == '1'){$status ='<span class="blue">Борея</span>';}
elseif($clan['r'] == '0'){$status ='<font color="indianred">Асура</font>';}
if($clan['id'] == $i['id'] && $clan_memb['rank'] > 3) {
$lost = mysql_fetch_array(mysql_query('SELECT * FROM `clan_msg` WHERE `clan` = ''.$i['id'].'' ORDER BY `time` DESC LIMIT 1'));
if($lost) echo '<div class="god3 center"><span class="gray">Объявления было размещено: '.(mb_strlen($lost['text'],'UTF-8') >= 11 ? mb_substr($lost['text'],0, 11, 'UTF-8').'...':bbc(smiles($lost['text']))).'</span><br/></div></div>';
echo '<div class="block_link2 light_bottom">
<a href="/clan/desk/"><img src="/images/icon/arrow.png"> Вывесить объявление</a></div><div class="hr"></div>
<div class="block_link2 light_bottom">
<a href="/clan/delete/"><img src="/images/icon/arrow.png"> Удалить клан</a></div><div class="hr"></div>
<div class="god4">
Удалять с клана могут: <font color="lightblue">'.$ranks.'</font><br/>
<img src="/images/icon/arrow.png"> <a href="/clan/rank/">Настроить удаление по званию</a></div><div class="hr"></div>
<div class="god4">
Приглашать в клан могут: <font color="lightblue">'.$rank.'</font><br/>
<img src="/images/icon/arrow.png"> <a href="/clan/invite/">Настроить приглашение по званию</a></div><div class="hr"></div>
<div class="god4">
Названия: <font color="lightblue">'.$clan['name'].'</font><br/>
<img src="/images/icon/arrow.png"> <a href="/clan/change/">Сменить названия клана <img src="/images/icon/gold.png">5000</a></div><div class="hr"></div>
<div class="god4">
Сторона клана: <font color="lightblue">'.$status.'</font><br/>
<img src="/images/icon/arrow.png"> <a href="/clan/storona/">Изменить сторону клана <img src="/images/icon/gold.png">500</a></div><div class="hr"></div>';
echo'<div class="god4">Об клане: ';
if(mb_strlen($clan['info']) > 15)
{$text = mb_substr(bb($clan['info']),0,15);
echo '<font color="lightblue">'.$text.'....</font><br/>';
}else{echo '<font color="lightblue">'.bb($clan['info']).'</font>'; }
echo'<br/><img src="/images/icon/arrow.png"> <a href="/clan/info/">Сменить информацию о клане </a></div><div class="hr"></div>
';
echo '</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';
switch($memb['rank']) {
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;}
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'].'"');
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'].'"');
header('location: /clan/memb/'.$memb['id'].'/');}}
?>
<div class="title2"><?=$memb_user['login']?></div>
<div class='god4'>
<?
switch($memb['rank']) {
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;}
?>
Звание: <?=$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='hr'></div>
<?
if($memb['rank'] != 4 && $memb['rank'] < $clan_memb['rank']) {
?>
<div class="god3 center"><div class="link_center">
<a href='/clan/memb/<?=$memb['id']?>/?up=true'><img src="/images/icon/ok.png"> Повысить</a>
</div></div>
<?
}
if($memb['rank'] < $clan_memb['rank'] && $memb['rank'] > 0) {
?>
<div class="god3 center"><div class="link_center">
<a href='/clan/memb/<?=$memb['id']?>/?down=true' class='btn nav-btn'>Понизить</a>
</div></div>
<?
}
?>
</div>
<?
if($clan_memb['rank'] == 4) {
if($_GET['lider'] == true) {
mysql_query('UPDATE `clan_memb` SET `rank` = "4" WHERE `id` = "'.$memb['id'].'"');
mysql_query('UPDATE `clan_memb` SET `rank` = "3" WHERE `user` = "'.$user['id'].'"');
header('location: /clan/');
}
?>
<div class="god3 center"><div class="link_center">
<a href='/clan/memb/<?=$memb['id']?>/?lider=true' class='btn nav-btn'>Передать лидерство</a>
</div></div>
<?
}
if($memb['rank'] < $clan_memb['rank'] && $clan_memb['rank'] >= $clan['rank_for_delete']) {
if($_GET['delete'] == true) {
$mm = mysql_fetch_assoc(mysql_query("SELECT * FROM `users` WHERE `id` = '$memb[user]' LIMIT 1"));
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>'.$mm['login'].'</span>","1","'.time().'")');
mysql_query('DELETE FROM `clan_memb` WHERE `id` = "'.$memb['id'].'"');
header('location: /clan/');
}
?>
<div class="god3 center"><div class="link_centers">
<a href='/clan/memb/<?=$memb['id']?>/?delete=true' class='btn nav-btn'><img src="/images/icon/error.png"> Исключить</a>
</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 / (50 / $i['built_1']));
function cost($i) {
switch($i) {
case 0:
$cost = 10000;
break;
case 1:
$cost = 10000;
break;
case 2:
$cost = 5000;
break;
case 3:
$cost = 20000;
break;
case 4:
$cost = 1800;
break;
case 5:
$cost = 30000;
break;
case 6:
$cost = 30000;
break;
case 7:
$cost = 25000;
break;
case 8:
$cost = 3600;
break;
case 9:
$cost = 35000;
break;
case 10:
$cost = 35000;
break;
case 11:
$cost = 35900;
break;
case 12:
$cost = 7200;
break;
case 13:
$cost = 37000;
break;
case 14:
$cost = 37900;
break;
case 15:
$cost = 38900;
break;
case 16:
$cost = 14400;
break;
case 17:
$cost = 39000;
break;
case 18:
$cost = 35000;
break;
case 19:
$cost = 35000;
break;
case 20:
$cost = 35000;
break;
case 21:
$cost = 40000;
break;
case 22:
$cost = 40900;
break;
case 23:
$cost = 40900;
break;
case 24:
$cost = 41000;
break;
case 25:
$cost = 41900;
break;
case 26:
$cost = 42000;
break;
case 27:
$cost = 42900;
break;
case 28:
$cost = 43900;
break;
case 29:
$cost = 44900;
break;
case 30:
$cost = 45900;
break;
case 31:
$cost = 46000;
break;
case 32:
$cost = 46900;
break;
case 33:
$cost = 47000;
break;
case 34:
$cost = 50000;
break;
case 35:
$cost = 55000;
break;
case 36:
$cost = 60000;
break;
case 37:
$cost = 63000;
break;
case 38:
$cost = 67000;
break;
case 39:
$cost = 73000;
break;
case 40:
$cost = 10000;
break;
case 41:
$cost = 75000;
break;
case 42:
$cost = 80000;
break;
case 43:
$cost = 85000;
break;
case 44:
$cost = 88000;
break;
case 45:
$cost = 90000;
break;
case 46:
$cost = 93000;
break;
case 47:
$cost = 95000;
break;
case 48:
$cost = 100000;
break;
case 49:
$cost = 126000;
break;
case 50:
$cost = 13800;
break;
case 51:
$cost = 138000;
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;
}
return $value;}
?>
<div class="title2">Статуя клана</div>
<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'>Улучшить <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="god4">
<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="god3">
<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">
<a href='/clan/built/?done=true' >Активировать <img src='/images/icon/gold.png' alt= '*' /> 5000 </a>
</div></div>
<?
}
?>
</div></div></div>
<div class="god4 center"><div class="menu_link">
<a href="/clan/">Вернуться назад</a>
</div></div>
<?
include './system/f.php';
break;
}
?>