battles/clan_log.php

130 lines
4.8 KiB
PHP

<?
session_start();
include("config.php");
include("functions.php");
mysql_query('SET NAMES UTF8');
if(!isset($_SESSION['uid'])) { header('Location: /index.php'); }
if($user['klan'] == '' || $user['klan'] != mysql_real_escape_string((int)$_GET['clan'])) { header('Location: /index.php'); }
if($user['clan_prava'] != 'glava') {
$utitl = mysql_fetch_array(mysql_query('SELECT * FROM `clan_tituls` WHERE `id` = "'.$user['clan_prava'].'" LIMIT 1'));
if(!isset($utitl['id'])) {
$utitl = mysql_fetch_array(mysql_query('SELECT * FROM `clan_tituls` WHERE `id` = 2 LIMIT 1'));
}
} else {
$utitl = mysql_fetch_array(mysql_query('SELECT * FROM `clan_tituls` WHERE `id` = 1 LIMIT 1'));
}
if(isset($utitl['id'])) {
$i = 1;
while($i < count($clan_acces)) {
if($utitl['prava'][$i] > 0) {
$clan_acces[$i][0] = 1;
}
$i++;
}
}
if(is_numeric($_GET['page'])) {
$numb = round($_GET['page']*15, 0);
} else {
$numb = 0;
}
if($clan_acces[6][0] == 1) {
$t = '<table border=0 width=100% cellspacing="0" cellpadding="2" bgcolor=CCC3AA><tr><td align=center colspan=2><font color="#003388"><b>Просмотр операций с казной</b></font> <span style="float: right;"><input type="text" id="logins" name="logins" placeholder="Логин" style="text-align: center;" /> <input id="find" type="button" value="Фильтр" /></span></td></tr></table><div id="content"><table width=100% cellspacing="num">';
$data = mysql_query("SELECT * FROM `clan_log` WHERE `clan_id` = '".$user['klan']."' ORDER BY `id` DESC LIMIT $numb, 15");
while($it = mysql_fetch_array($data)) {
$i++;
if($i == 1) {
$t .= "<tr><td class='solid'>&nbsp;</td><td align='left' class='solid'><b>&nbsp;&nbsp;Когда</b></td><td align='left' class='solid'><b>&nbsp;&nbsp;&nbsp;&nbsp;Кто</b></td><td align='right' class='solid'><b>Сколько</b></td></tr>";
}
if($it['type'] == 1) {
$pp = "<img src=\"i/kazna_put.gif\" title=\"Положил кредиты\" />"; $dop = 'Кр.';
} elseif($it['type'] == 2) {
$pp = "<img src=\"i/kazna_put.gif\" title=\"Положил еврокредиты\" />"; $dop = 'Екр.';
}
$it['date'] = date('d.m.y h:i', $it['time']);
$it['login'] = Nick::id($it['user_id'])->full(1);
$it['coms'] = ' <nobr>Комментарий : '.$it['comment'].'</nobr>';
$t .= "<tr><td class='dash' align='center' width='10'>".$pp."</td><td class=dash align=left width=10>&nbsp;&nbsp;<nobr>".$it['date']."</nobr></td><td class='dash' align='left'>&nbsp;<nobr>".$it['login']."</nobr>".$it['coms']."</td><td class='dash' align='right'>".$it['suma']."&nbsp;$dop</td></tr>";
}
$t .= '</table>';
$t .= "Страницы: ";
$data2 = mysql_query("SELECT * FROM `clan_log` WHERE `clan_id`= '{$user['klan']}'"); $all = mysql_num_rows($data2)-1; $pgs = $all/15;
for($is = 0; $is <= $pgs; ++$is) {
if($_GET['page'] == $is) {
$t .= '<font class=number>'.($is+1).'</font>&nbsp;';
} else {
$t .= '<a href="?act=caznalog&clan='.$user['klan'].'&hash='.md5($user['id'].'|'.$user['login']).'&page='.$is.'">'.($is+1).'</a>&nbsp;';
}
$t .= '</div>';
}
} else {
$t = 'Недостаточно прав';
}
?>
<html>
<head>
<title>Просмотр действий с кланом</title>
<link rel="stylesheet" type="text/css" href="css/main.css" />
<? if($clan_acces[6][0] == 1) { ?>
<script>
$(function() {
$("#find").on("click", function() {
var login = $("#logins").val();
let hash = '<?=md5($user['
if(!login) {
alert('Введите логин');
} else {
$.ajax({
type: 'POST',
url: 'ajax/clan_log.php',
data: "&user="+<?=$user['id'];?>+"&hash="+hash+"&sorted="+login,
dataType : 'json',
success: function(data) {
if(!data.success) {
alert(data.errors.name);
} else {
$('#content').remove(); $('#pages').remove();
console.log(data.posted);
}
}
})
}
})
})
</script>
<? } ?>
</head>
<body style="background-color: #dedede; margin: 0; padding: 0;">
<style>
td.dash {
border-bottom-style: dotted;
border-color: black;
border-width: 1px;
}
td.solid {
border-bottom-style: solid;
border-color: black;
border-width: 2px;
}
</style>
<?
if($_GET['act'] == 'caznalog') {
$clan = mysql_real_escape_string((int)$_GET['clan']);
if($clan > 0) {
if($_GET['hash'] != '') {
if($_GET['hash'] == md5($user['id'].'|'.$user['login'])) {
echo $t;
}
}
}
}
?>
</body>
</html>