Файл: impwar.tk/clan_log.php
Строк: 224
<?php
require_once('conf/dbc.php');
require_once('conf/session_start.php');
require_once('conf/ban.php');
if((!isset($_SESSION['id'])) and (!isset($_SESSION['nick']))) {
?> <script type="text/javascript"> document.location.href = "reg.php?err_login=1"; </script><?php
}
$page_title = 'Журнал отряда';
require_once('conf/head.php');
require_once('conf/top.php');
$log_id = abs(intval($_SESSION['id']));
$row_ch=$dbc->query("Select * from users where id = '$log_id' LIMIT 1")->fetch_assoc();
if ($row_ch['clan'] == 0) {
?>
<script type="text/javascript">
document.location.href = "index.php";
</script>
<?php
exit();
}
$clan_ch = $row_ch['clan'];
$clan_rang_ch = $row_ch['clan_rang'];
$row_user=$dbc->query("Select gruppa, nick from users where id = '$log_id'");
$clan=$dbc->query("SELECT * FROM `clans` WHERE`clan_id`='$clan_ch' LIMIT 1")->fetch_assoc();
if (!empty($clan_ch)) {
?>
<center><div class="r6">Журнал отряда <span class="lal2"><?php echo $clan['name'];?></span></center> <?php
$count=mysqli_num_rows(mysqli_query($dbc,"SELECT COUNT(*) FROM `clan_log` where clan_id = '$clan_ch'"));
include_once 'nav_class.php';
//Эх подстраничная навигация нелезть:)
$nstr='15'; //Сообщений на страницу
$countQ=$dbc->query("SELECT * FROM`clan_log` where clan_id = '$clan_ch'"); #запрос в бд
$count=mysqli_num_rows($countQ); //Подсчёт строк
$pages = new Navigator($count,$nstr); #Вызов класса подстраничной навигации и расчёт страниц
$str = $pages -> start; //Сам хз что))
//----------//
$news="SELECT * FROM news ";
$query_chat = "SELECT * FROM `clan_log` where clan_id = '$clan_ch' ORDER BY`log_id` DESC LIMIT $str,$nstr";
$result_chat = mysqli_query($dbc, $query_chat) or die ('Ошибка передачи запроса к БД1');
$count_chat = mysqli_num_rows($result_chat);
if (!empty($count_chat)) {
while ($clan_log= mysqli_fetch_array($result_chat)) {
$user=$dbc->query("Select * from users where id = '".$clan_log['user_id']."'")->fetch_assoc();
$g=$user['clan_rang'];
if($g=='0'){$clan_rang='<img src="/img/plus2.png" height="12" width="12"/>';}elseif($g=='1'){$clan_rang='<img src="/img/rangs/rekryton.png" height="12" width="12"/>';}elseif($g=='2'){$clan_rang='<img src="/img/rangs/ryadovoyon.png" height="12" width="12"/>';}elseif($g=='3'){$clan_rang='<img src="/img/rangs/serjanton.png" height="12" width="12"/>';}elseif($g=='4'){$clan_rang='<img src="/img/rangs/leitenanton.png" height="12" width="12"/>';}elseif($g=='5'){$clan_rang='<img src="/img/rangs/kapitanon.png" height="12" width="12"/>';}elseif($g=='6'){$clan_rang='<img src="/img/rangs/mayoron.png" height="12" width="12"/>';}elseif($g=='7'){$clan_rang='<img src="/img/rangs/polkovnikon.png" height="12" width="12"/>';}elseif($g=='8'){$clan_rang='<img src="/img/rangs/generalon.png" height="12" width="12"/>';}elseif($g=='9'){$clan_rang='<img src="/img/rangs/lideron.png" height="12" width="12"/>';}
$last_active = $user['last_active'];$last_active = strtotime("$last_active");$now = (date("Y-m-d H:i:s"));$now = strtotime("$now");$ont = ($now - $last_active);
if($ont<300){$onl='<img src="/img/ico/on.png" height="12" width="12"/>';}else{$onl='<img src="/img/ico/off.png" height="12" width="12"/>';}
if($clan_log['tip']=='1'){$tip='<span class="bonus">повысил</span>';}elseif($clan_log['tip']=='2'){$tip='<span class="red">понизил</span>';}elseif($clan_log['tip']=='3'){$tip='<span class="red">исключил</span>';}elseif($clan_log['tip']=='4'){$tip='<span class="bonus">пригласил</span>';}elseif($clan_log['tip']=='5'){$tip='<span class="bonus">вступил в отряд</span>';}elseif($clan_log['tip']=='6'){$tip='<span class="red">вышел с отряда</span>';}elseif($clan_log['tip']=='7'){$tip='<span class="bonus">передал лидерство</span>';}
$razn_last_act=time()-$clan_log[time];
echo'<p>[';
include'conf/time.php';
echo']';
?><?php echo $onl;?><?php echo $clan_rang;?> <a style="text-decoration:none;" class="lal2" href="user.php?id=<?php echo $clan_log['user_id'];?>"><span class="white"><?php echo $user['nick'];?></span></a>
<?php echo $tip;?><?php
if($clan_log['tip']<>'5' and $clan_log['tip']<>'6' and $clan_log['tip']<>'7'){echo'
игрока <span class="white">'.$clan_log['user'].'</span>
';}
if($clan_log['tip']=='7'){echo'
игроку <span class="white">'.$clan_log['user'].'</span>
';}
if($row_ch['clan_rang']>=9 and isset($_GET['did'])){$dbc->query("DELETE FROM`clan_log` WHERE`log_id`='".intval($_GET['did'])."'");header('location: ?');
}
if($row_ch['clan_rang']>=9){echo'<a style="text-decoration:none;" href="?did='.($clan_log['log_id']).'"><span class="red"> (удалить)</span></a>';}
?>
<p style="border-top: dashed 1px #444e4f"></p>
<?php
}
}
if($count==0){echo'<p style="border-top: dashed #444e4f 1px;"></p>Журнал отряда пуст!<p style="border-top: dashed #444e4f 1px;"></p>';}
$pages->print_nav('&'); //Навигация г
if($row_ch['clan_rang']>=9 and $count>0){?><div class="r2"><a style="text-decoration:none;" href="delclanlog.php" onclick="return confirm
('Уверены?')"><span class="red"> Очистить журнал</span></a></div> <?php
}
}
require_once('conf/navig.php');
require_once('conf/foot.php');
mysqli_close($dbc);
?>