Файл: impwar.tk/clan.php
Строк: 704
<?php
require_once('conf/dbc.php');
require_once('conf/session_start.php');
require_once('conf/ban.php');
$page_title = 'Отряд';
require_once('conf/head.php');
if ((isset($_SESSION['id'])) and (isset($_SESSION['nick']))) {
$user_id = abs(intval($_SESSION['id']));
$dbc->query("update users set location = 'company' where id = '$user_id' limit 1");
require_once('conf/top.php');
}
$user_id = abs(intval($_SESSION['id']));
$usg3=$dbc->query("SELECT * FROM `users` WHERE`id`='$user_id'")->fetch_assoc();
$clan_id = abs(intval($_GET['id']));
if (empty($clan_id)) {
require_once('conf/notclan.php');
}
else {
$query_out = "Select clan, clan_rang, nick from users where id = '$user_id'";
$result_out = mysqli_query($dbc, $query_out) or die ('Ошибка передачи запроса к БД');
$row_out = mysqli_fetch_array($result_out);
$clan_out = $row_out['clan'];
$rang_out = $row_out['clan_rang'];
$nick_out = $row_out['nick'];
$rule = filter($_GET['rule']);
if (!empty($rule)) {
if ($clan_id <> $clan_out or $rang_out < 6) {
?>
<script type="text/javascript">
document.location.href = "clan.php?id=<?php echo "$clan_id";?>";
</script>
<?php
exit();
}
}
$query = "Select * from clans where clan_id = '$clan_id'";
$result = mysqli_query($dbc, $query) or die ('Ошибка передачи запроса к БД');
$row = mysqli_fetch_array($result);
if ($row == 0) {
require_once('conf/notclan.php');
}
else {
$name = $row['name'];
$gruppa = $row['gruppa'];
$clan_opit = $row['clan_opit'];
$slava=$row['slava'];
$mentor = $row['mentor'];
$ava = $row['ava'];
echo '<br/><center><div class="name2">Отряд: ';
if ($row['gruppa'] == 'svoboda') {?><img src="img/ico/svobodaon.png" width="12" height="12"/><?php }
if ($row['gruppa'] == 'dolg') {?><img src="img/ico/dolgon.png" width="12" height="12"/><?php }
if ($row['gruppa'] == 'naemniki') {?><img src="img/ico/naemniki.png" width="12" height="12"/><?php }
if ($row['gruppa'] == 'renegat') {?><img src="img/ico/renegat.png" width="12" height="12"/><?php }
if ($row['gruppa'] == 'chistoenebo') {?><img src="img/ico/chistoenebo.png" width="12" height="12"/><?php }
echo " $name"; ?></center></div>
<?php
$total = $row['people'];
$max_people = $row['max_people'];
?>
<?php
///////////////////////////////Ошибка
$err = filter($_GET['err']);
if (!empty($err)) {
?>
<?php
if ($err = 'out') {
echo "В клане никого не должно быть.";}
?>
</div>
<?php
}
//////////////////////////Конец ошибки
?>
<?php
$query_lvl = "Select lvl, opit from clan_opit order by lvl desc";
$result_lvl = mysqli_query($dbc, $query_lvl) or die ('Ошибка передачи запроса к БД');
$row_lvl = mysqli_fetch_array($result_lvl);
$big_next_lvl = $row_lvl['opit'];
$lvl=$row_lvl['lvl'];
while (($clan_opit/1000)< $row_lvl['opit']) {
$next_lvl = $row_lvl['opit'];
$lvl=($lvl-1);
$row_lvl = mysqli_fetch_array($result_lvl);
}
if ($next_lvl == 0) {
$next_lvl = "$big_next_lvl" ;
}
$next_lvl = ($next_lvl/100);
$clan_opit = ($clan_opit/100000);
$clan_opit = round($clan_opit,2);
$query_c = "Select * from users where clan = '$clan_id' and last_active > NOW() - (60*5)";
$result_c = mysqli_query($dbc, $query_c) or die ('Ошибка передачи запроса к БД');
$row_c = mysqli_num_rows($result_c);
echo '<div style="background-color: #0b0b0b;"><style="border-top:1px solid #000000; background-color:#000000;"> ';
$query = "Select * from clans where clan_id = '$clan_id'";
$result = mysqli_query($dbc, $query) or die ('Ошибка передачи запроса к БД');
$row = mysqli_fetch_array($result);
echo'<center><img src="/img/clan_av/'.$row['ava'].'" width="250" height="200"/></center>';
$stat=$dbc->query("SELECT `nadpis` FROM`clans` WHERE`clan_id`='$clan_id'")->fetch_assoc();
if(strlen($stat['nadpis'])>2){
$nadpis='<p class="podmenu" style="border-top:1px solid #444e4f; background-color:#1c252f;"></p><div style="color:#B5B5B5;font-size:14px;font-weight:bold;margin-top: 4px;margin-bottom: 4px;background: url(/style/img/titles.png) 100% no-repeat;background-size: cover;">'.$stat['nadpis'].'</div>';
}else{$nadpis='<p class="podmenu" style="border-top:1px solid #444e4f; background-color:#1c252f;"></p><div style="color:#B5B5B5;font-size:15px;font-weight:bold;margin-top: 4px;margin-bottom: 4px;background: url(/style/img/titles.png) 100% no-repeat;background-size: cover;">Вступай в наши ряды!</div>';}
echo $nadpis;
?>
<div style="background-color: #1E1E1E;">
<p class="podmenu" style="border-top:1px solid #444e4f; background-color:#1c252f;"></p>
<img src="img/ico/lvl.gif" width="12" height="12" alt="н"/><span class="darkkhaki">Уровень: </span><span class="white"><?php echo "$lvl"?></span>
</p><img src="img/ico/slava.png" width="12" height="12" alt="н"/><span class="darkkhaki">Слава: </span><span class="white"><?php echo "$slava"?></span></p>
<p><img src="img/ico/star.png" width="12" height="12"/><span class="darkkhaki">Опыт: </span><span class="white"><?php echo "$clan_opit"; ?>к / <?php echo "$next_lvl";?>к</span></p>
<?php
if ($row['gruppa'] == 'svoboda') {?> <img src="img/ico/svobodaon.png" width="12" height="12"/><span class="darkkhaki">Группировка: </span><span class="white">Свобода</p></span><?php }
if ($row['gruppa'] == 'dolg') {?><img src="img/ico/dolgon.png" width="12" height="12"/><span class="darkkhaki">Группировка: </span><span class="white">Долг</p></span><?php }
if ($row['gruppa'] == 'naemniki') {?> <img src="img/ico/naemniki.png" width="12" height="12"/><span class="darkkhaki">Группировка: </span><span class="white">Наемники</p></span><?php }
if ($row['gruppa'] == 'renegat') {?><img src="img/ico/renegat.png" width="12" height="12"/><span class="darkkhaki">Группировка: </span><span class="white">Ренегаты</p></span><?php }
if ($row['gruppa'] == 'chistoenebo') {?> <img src="img/ico/chistoenebo.png" width="12" height="12"/><span class="darkkhaki">Группировка: </span><span class="white">Чистое небо</p></span><?php }
if ($clan_out == $clan_id) {?> <img src="img/ico/chel.png" width="12" height="12"/><span class="darkkhaki">Состав: </span><span class="white">[<?php echo "$total"; ?> / <?php echo "$max_people"; ?>]</span><?php }
$cena=($max_people*24500);
if ($clan_out == $clan_id and $usg3['clan_rang']==9 and $row['max_people']<20) {?><a style="text-decoration:none;" href="clanq.php?tip=4"><span class="bonus"> Поднять на 1</span><span class="net"> (<?php echo "$cena"; ?> <img src="img/ico/materials.png" width="12" height="12"/>)</span></a><?php }
?>
<?php if(!empty($_GET['pepl'])) {?>
<?php if ($_GET['pepl']==1) {echo '<p style="border-top: dashed #444e4f 1px;"></p><span class="red">В складе отряда недостаточно хабара!</span><p>';}?>
<?php if ($_GET['pepl']==2) {echo '<p style="border-top: dashed #444e4f 1px;"></p><span class="bonus">Изменения приняты</span><p>';}?>
<?php if ($_GET['pepl']==3) {echo '<p style="border-top: dashed #444e4f 1px;"></p><span class="red">Максимальный уровень!</span><p>';}?>
<?php }
echo '</div><p class="podmenu" style="border-top:1px solid #444e4f; background-color:#1c252f;"></p>';
switch($_GET[vid]){
default:
?>
<table class="foot" width="100%" border="0" cellpadding="0" cellspacing="0" style="padding-top: 5px;">
<tbody>
<tr>
<td width="33%">
<a class="big-but" href="clan.php?id=<?php echo "$clan_id";?>&vid=sost">
<div class="imgwrap"><img src="img/ico/chel.png"></div>
<span> Состав: [<?php echo "$total"; ?> / <?php echo "$max_people"; ?>]</span></a>
</td>
<td width="33%">
<a class="big-but" href="forum.php?type=company&company=<?php echo "$clan_id"?>">
<div class="imgwrap"><img src="img/ico/chat.png"></div><span>Форум</span></a>
</td>
<td width="33%">
<a class="big-but" href="chatcompany.php">
<div class="imgwrap"><img src="img/ico/m-antispam.png"></div><span>Чат</span></a>
</td>
</tr><tr><td width="33%">
<a class="big-but" href="gerb.php">
<div class="imgwrap"><?php
if ($row['gruppa'] == 'svoboda') {?><img src="img/ico/svobodaon.png" width="12" height="12"/></span><?php }
if ($row['gruppa'] == 'dolg') {?><img src="img/ico/dolgon.png" width="12" height="12"/></span><?php }
if ($row['gruppa'] == 'naemniki') {?> <img src="img/ico/naemniki.png" width="12" height="12"/></span><?php }
if ($row['gruppa'] == 'renegat') {?><img src="img/ico/renegat.png" width="12" height="12"/></span><?php }
if ($row['gruppa'] == 'chistoenebo') {?> <img src="img/ico/chistoenebo.png" width="12" height="12"/></span><?php }
?></div><span> Герб</span></a>
</td><td width="33%">
<a class="big-but" href="sklad.php">
<div class="imgwrap"><img src="img/sklad.png"></div><span>Склад <?php
if($row['ohota_time'] < time() and $row['ohota'] == 1 or $row['ohota'] == 0)
{echo'<span style=color:#3CFF00;font-size:15px;> + </span>';}
?></span></a>
</td><td width="33%">
<a class="big-but" href="clan_log.php">
<div class="imgwrap"><img src="img/ico/forum.png"></div><span>Журнал</span></a>
</td>
</tr><tr><td width="33%">
<a class="big-but" href="cbon.php">
<div class="imgwrap"><img src="img/ico/dos.png"></div><span>Постройки</span></a>
<?php
if ($clan_out == $clan_id and $rang_out > 5) {
?>
</td><td width="33%">
<a class="big-but" href="clanq.php">
<div class="imgwrap"><img src="img/ico/remont.png"></div><span>Управление</span></a>
</td><?php
}
if ($clan_out == $clan_id and $rang_out < 9) {
?><td width="33%">
<a class="big-but" href="agree.php?inf=company">
<div class="imgwrap"><img src="img/ico/out.png"></div><span>Выйти</span></a>
</td>
</tr>
</tbody></table>
<?php
if ($clan_out == $clan_id) {?>
<?php
}
}
break;
case 'sost':
////////////////////Эх подстраничная навигация нелезть:)
$count=$dbc->query("SELECT COUNT(*) from `users` where `clan` = '".$clan_id."'");
include_once 'nav_class.php';
$nstr='10'; //Сообщений на страницу
$countQ=$dbc->query("SELECT * FROM `users` where `clan` = '".$clan_id."'"); #запрос в бд
$count=mysqli_num_rows($countQ); //Подсчёт строк
$pages = new Navigator($count,$nstr); #Вызов класса подстраничной навигации и расчёт страниц
$str = $pages -> start; //Сам хз что))
$query_us = "Select * from users where clan = '$clan_id' order by last_active > NOW()-300 DESC, clan_rang DESC, ko desc limit $str,$nstr";
$result_us = mysqli_query($dbc, $query_us) or die ('Ошибка передачи запроса к БД');
while ($row_us = mysqli_fetch_array($result_us)) {
$nick = $row_us['nick'];
$clan_rang = $row_us['clan_rang'];
$id_us = $row_us['id'];
$ko = $row_us['ko'];
$ko = ($ko/100000);
$ko = round($ko,2);
$last_active = $row_us['last_active'];
$slava = $row_us['slava'];
$last_active = strtotime("$last_active");
$now = (date("Y-m-d H:i:s"));
$now = strtotime("$now");
$razn_last_act = ($now - $last_active);
echo '<a style="text-decoration:none;" href="profile.php?id='.$id_us.'">';
if ($row_us['clan_rang'] == '1') {
if ($razn_last_act > 300 ) {?>
<img src="img/rangs/rekryt.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/rangs/rekryton.png" width="12" height="12" alt="н"/><?php }}
if ($row_us['clan_rang'] == '2') { if ($razn_last_act > 300 ) {?><img src="img/rangs/ryadovoy.png" width="12" height="12"alt="р"/><?php } else {?><img src="img/rangs/ryadovoyon.png" width="12" height="12"alt="р"/><?php }}
if ($row_us['clan_rang'] == '3') { if ($razn_last_act > 300 ) {?><img src="img/rangs/serjant.png" width="12" height="12" alt="с"/><?php } else {?><img src="img/rangs/serjanton.png" width="12" height="12" alt="с"/><?php }}
if ($row_us['clan_rang'] == '4') { if ($razn_last_act > 300 ) {?><img src="img/rangs/leitenant.png" width="12" height="12" alt="л"/><?php } else {?><img src="img/rangs/leitenanton.png" width="12" height="12" alt="л"/><?php }}
if ($row_us['clan_rang'] == '5') { if ($razn_last_act > 300 ) {?><img src="img/rangs/kapitan.png" width="12" height="12" alt="к"/><?php } else {?><img src="img/rangs/kapitanon.png" width="12" height="12" alt="к"/><?php }}
if ($row_us['clan_rang'] == '6') { if ($razn_last_act > 300 ) {?><img src="img/rangs/mayor.png" width="12" height="12" alt="м"/><?php } else {?><img src="img/rangs/mayoron.png" width="12" height="12" alt="м"/><?php }}
if ($row_us['clan_rang'] == '7') { if ($razn_last_act > 300 ) {?><img src="img/rangs/polkovnik.png" width="12" height="12" alt="п"/><?php } else {?><img src="img/rangs/polkovnikon.png" width="12" height="12" alt="п"/><?php }}
if ($row_us['clan_rang'] == '8') { if ($razn_last_act > 300 ) {?><img src="img/rangs/general.png" width="12" height="12" alt="г"/><?php } else {?><img src="img/rangs/generalon.png" width="12" height="12" alt="г"/><?php }}
if ($row_us['clan_rang'] == '10') { if ($razn_last_act > 300 ) {?><img src="img/rangs/marshal.png" width="12" height="12" alt="л"/><?php } else {?><img src="img/rangs/marshalon.png" width="12" height="12" alt="м"/><?php }}
if ($row_us['clan_rang'] == '9') { if ($razn_last_act>300 ) {?><img src="img/rangs/lider.png" width="12" height="12" alt="п"/><?php } else {?><img src="img/rangs/lideron.png"width="12"height="12"alt="л"/><?php }}
?>
<?php echo "$nick";?><span class="white"> (<?php echo "$ko";?>к)</span></a><?php if ($clan_out == $clan_id and $rang_out>$clan_rang) { if ($rang_out>($clan_rang+1)) {?>[<a style="text-decoration:none;" href="rang.php?inf=up&id=<?php echo "$id_us";?>">Повысить</a>]<?php } if (0<($clan_rang-1)) {?> [<a style="text-decoration:none;" href="rang.php?inf=down&id=<?php echo "$id_us";?>">Понизить</a>]<?php } if ($rang_out==9) {?> [<a style="text-decoration:none;" href="rang.php?inf=lider&id=<?php echo "$id_us";?>">+Лидер</a>]<?php }?> [<a style="text-decoration:none;" href="agree.php?inf=outuser&id=<?php echo "$id_us";?>">Исключить</a>]<?php }?>
<?php
if ($row_us['clan_rang'] == '1') {?> -Рекрут<?php }
if ($row_us['clan_rang'] == '2') {?> -Рядовой<?php }
if ($row_us['clan_rang'] == '3') {?> -Сержант<?php }
if ($row_us['clan_rang'] == '4') {?> -Лейтенант<?php }
if ($row_us['clan_rang'] == '5') {?> -Капитан<?php }
if ($row_us['clan_rang'] == '6') {?> -Майор<?php }
if ($row_us['clan_rang'] == '7') {?> -Полковник<?php }
if ($row_us['clan_rang'] == '8') {?><span class="bonus"> -Генерал</span><?php }
if ($row_us['clan_rang'] == '9') {?><span class="yellow"> -Лидер</span><?php }
$rank = $row['clan_rang'];
?>
<p class="zx"></p>
<?php
}
if($count==0){echo'<p style="border-top: dashed #444e4f 1px;"></p>Сталкеров в отряде нет!<p style="border-top: dashed #444e4f 1px;"></p>';}
if($count==10){$pages->print_nav('&id='.$clan_id.'&vid=sost');} //Навигация гг
echo'<a class="prof" href="clan.php?id='.$clan_id.'&vid=online"><img src="img/ico/on.png" width="12" height="12"/>Онлайн '.$row_c.'</a>
<a class="prof" href="clan.php?id='.$clan_id.'"><img src="/img/reload.gif" width="12" height="12"/>Назад</a>';
break;
case 'online':
////////////////////Эх подстраничная навигация нелезть:)
$count=$dbc->query("SELECT COUNT(*) from `users` where last_active > NOW() - (60*5) and `clan` = '".$clan_id."'");
include_once 'nav_class.php';
$nstr='10'; //Сообщений на страницу
$countQ=$dbc->query("SELECT * FROM `users` where `clan` = '".$clan_id."'"); #запрос в бд
$count=mysqli_num_rows($countQ); //Подсчёт строк
$pages = new Navigator($count,$nstr); #Вызов класса подстраничной навигации и расчёт страниц
$str = $pages -> start; //Сам хз что))
$query_us = "Select * from users where last_active > NOW() - (60*5) and clan = '$clan_id' order by last_active > NOW()-300 DESC, clan_rang DESC, ko desc limit $str,$nstr";
$result_us = mysqli_query($dbc, $query_us) or die ('Ошибка передачи запроса к БД');
while ($row_us = mysqli_fetch_array($result_us)) {
$nick = $row_us['nick'];
$clan_rang = $row_us['clan_rang'];
$id_us = $row_us['id'];
$ko = $row_us['ko'];
$ko = ($ko/100000);
$ko = round($ko,2);
$last_active = $row_us['last_active'];
$slava = $row_us['slava'];
$last_active = strtotime("$last_active");
$now = (date("Y-m-d H:i:s"));
$now = strtotime("$now");
$razn_last_act = ($now - $last_active);
echo '<a style="text-decoration:none;" href="profile.php?id='.$id_us.'">';
if ($row_us['clan_rang'] == '1') {
if ($razn_last_act > 300 ) {?>
<img src="img/rangs/rekryt.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/rangs/rekryton.png" width="12" height="12" alt="н"/><?php }}
if ($row_us['clan_rang'] == '2') { if ($razn_last_act > 300 ) {?><img src="img/rangs/ryadovoy.png" width="12" height="12"alt="р"/><?php } else {?><img src="img/rangs/ryadovoyon.png" width="12" height="12"alt="р"/><?php }}
if ($row_us['clan_rang'] == '3') { if ($razn_last_act > 300 ) {?><img src="img/rangs/serjant.png" width="12" height="12" alt="с"/><?php } else {?><img src="img/rangs/serjanton.png" width="12" height="12" alt="с"/><?php }}
if ($row_us['clan_rang'] == '4') { if ($razn_last_act > 300 ) {?><img src="img/rangs/leitenant.png" width="12" height="12" alt="л"/><?php } else {?><img src="img/rangs/leitenanton.png" width="12" height="12" alt="л"/><?php }}
if ($row_us['clan_rang'] == '5') { if ($razn_last_act > 300 ) {?><img src="img/rangs/kapitan.png" width="12" height="12" alt="к"/><?php } else {?><img src="img/rangs/kapitanon.png" width="12" height="12" alt="к"/><?php }}
if ($row_us['clan_rang'] == '6') { if ($razn_last_act > 300 ) {?><img src="img/rangs/mayor.png" width="12" height="12" alt="м"/><?php } else {?><img src="img/rangs/mayoron.png" width="12" height="12" alt="м"/><?php }}
if ($row_us['clan_rang'] == '7') { if ($razn_last_act > 300 ) {?><img src="img/rangs/polkovnik.png" width="12" height="12" alt="п"/><?php } else {?><img src="img/rangs/polkovnikon.png" width="12" height="12" alt="п"/><?php }}
if ($row_us['clan_rang'] == '8') { if ($razn_last_act > 300 ) {?><img src="img/rangs/general.png" width="12" height="12" alt="г"/><?php } else {?><img src="img/rangs/generalon.png" width="12" height="12" alt="г"/><?php }}
if ($row_us['clan_rang'] == '10') { if ($razn_last_act > 300 ) {?><img src="img/rangs/marshal.png" width="12" height="12" alt="л"/><?php } else {?><img src="img/rangs/marshalon.png" width="12" height="12" alt="м"/><?php }}
if ($row_us['clan_rang'] == '9') { if ($razn_last_act>300 ) {?><img src="img/rangs/lider.png" width="12" height="12" alt="п"/><?php } else {?><img src="img/rangs/lideron.png"width="12"height="12"alt="л"/><?php }}
?>
<?php echo "$nick";?><span class="white"> (<?php echo "$ko";?>к)</span></a><?php if ($clan_out == $clan_id and $rang_out>$clan_rang) { if ($rang_out>($clan_rang+1)) {?>[<a style="text-decoration:none;" href="rang.php?inf=up&id=<?php echo "$id_us";?>">Повысить</a>]<?php } if (0<($clan_rang-1)) {?> [<a style="text-decoration:none;" href="rang.php?inf=down&id=<?php echo "$id_us";?>">Понизить</a>]<?php } if ($rang_out==9) {?> [<a style="text-decoration:none;" href="rang.php?inf=lider&id=<?php echo "$id_us";?>">+Лидер</a>]<?php }?> [<a style="text-decoration:none;" href="agree.php?inf=outuser&id=<?php echo "$id_us";?>">Исключить</a>]<?php }?>
<?php
if ($row_us['clan_rang'] == '1') {?> -Рекрут<?php }
if ($row_us['clan_rang'] == '2') {?> -Рядовой<?php }
if ($row_us['clan_rang'] == '3') {?> -Сержант<?php }
if ($row_us['clan_rang'] == '4') {?> -Лейтенант<?php }
if ($row_us['clan_rang'] == '5') {?> -Капитан<?php }
if ($row_us['clan_rang'] == '6') {?> -Майор<?php }
if ($row_us['clan_rang'] == '7') {?> -Полковник<?php }
if ($row_us['clan_rang'] == '8') {?><span class="bonus"> -Генерал</span><?php }
if ($row_us['clan_rang'] == '9') {?><span class="yellow"> -Лидер</span><?php }
$rank = $row['clan_rang'];
?>
<p class="zx"></p>
<?php
}
if($count==0){echo'<p style="border-top: dashed #444e4f 1px;"></p>Сталкеров в отряде нет!<p style="border-top: dashed #444e4f 1px;"></p>';}
if($count==10){$pages->print_nav('&id='.$clan_id.'&vid=sost');} //Навигация гг
echo'<a class="prof" href="clan.php?id='.$clan_id.'&vid=sost"><img src="/img/reload.gif" width="12" height="12"/>Назад</a>';
break;
}
}
}
require_once('conf/navig.php');
require_once('conf/foot.php');
mysqli_close($dbc);
?>
</body>
</html>