2018-01-28 21:22:28 +00:00
|
|
|
|
<?php
|
2018-01-28 16:40:49 +00:00
|
|
|
|
session_start();
|
|
|
|
|
if(!isset($_SESSION['uid'])) { header('Location: ../../index.php'); exit(); }
|
|
|
|
|
include('../../config.php');
|
|
|
|
|
include('../../functions.php');
|
|
|
|
|
|
2018-01-28 21:22:28 +00:00
|
|
|
|
$clan_acces = array(
|
|
|
|
|
1 => array(0, 'Просмотр событий клана'),
|
|
|
|
|
2 => array(0, 'Создание событий клана'),
|
|
|
|
|
3 => array(0, 'Просмотр хранилища'),
|
|
|
|
|
4 => array(0, 'Использование вещей из хранилища'),
|
|
|
|
|
5 => array(0, 'Изъятие предметов из хранилища'),
|
|
|
|
|
6 => array(0, 'Просмотр казны и списка игроков, пополнявших казну'),
|
|
|
|
|
7 => array(0, 'Пополнение казны'),
|
|
|
|
|
8 => array(0, 'Использование казны'),
|
|
|
|
|
9 => array(0, 'Прием в клан'),
|
|
|
|
|
10 => array(0, 'Изгнание из клана'),
|
|
|
|
|
11 => array(0, 'Редактирование информации о клане')
|
|
|
|
|
);
|
|
|
|
|
|
2018-01-28 16:40:49 +00:00
|
|
|
|
if($user['klan'] == '') { header('Location: ../../main.php'); exit(); }
|
|
|
|
|
$clan = mysql_fetch_array(mysql_query('SELECT `id`, `recruits`, `short`, `name`, `descr`, `glava`, `money`, `ekr`, `vozm`, `align`, `mshadow`, `wshadow`, `homepage`, `rating`, `zbor`, `zamok`, `izamok`, `ifon` FROM `clans` WHERE `id` = "'.$user['klan'].'" LIMIT 1'));
|
|
|
|
|
$err = '';
|
|
|
|
|
|
|
|
|
|
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($_GET['addcredits']) {
|
|
|
|
|
if($clan_acces[7][0] == 1) {
|
|
|
|
|
if($user['money'] >= $_GET['sums'] && $_GET['sums'] > 0) {
|
|
|
|
|
if(isset($_GET['comment']) && $_GET['comment'] != '') {
|
|
|
|
|
$user['money'] -= (int)$_GET['sums'];
|
|
|
|
|
$clan['money'] += (int)$_GET['sums'];
|
|
|
|
|
$text = mysql_real_escape_string(iconv("utf-8", "utf-8", $_GET['comment']));
|
|
|
|
|
mysql_query('UPDATE `users` SET `money` = "'.$user['money'].'" WHERE `id` = "'.$user['id'].'" LIMIT 1');
|
|
|
|
|
mysql_query('UPDATE `clans` SET `money` = "'.$clan['money'].'" WHERE `id` = "'.$clan['id'].'" LIMIT 1');
|
|
|
|
|
mysql_query("INSERT INTO `delo` (`author`, `pers`, `text`, `type`, `date`) VALUES ('0', '{$user['id']}', '\"".$user['login']."\" Пополнил казну клана: ($clan[name] / $clan[id]) на сумму: ".(int)$_GET['sums']." кр. С пометкой : $text', '1', '".time()."')");
|
|
|
|
|
mysql_query('INSERT INTO `clan_log` (`clan_id`, `user_id`, `time`, `type`, `suma`, `comment`) VALUES ("'.$clan['id'].'", "'.$user['id'].'", "'.time().'", "1", "'.(int)$_GET['sums'].'", "'.$text.'")');
|
|
|
|
|
$err = '<b style="color: Red;">Казна пополненна на '.(int)$_GET['sums'].' кр.</b>';
|
|
|
|
|
} else {
|
|
|
|
|
$err = '<b style="color: Red;">Введите комментарий</b>';
|
|
|
|
|
}
|
|
|
|
|
} elseif($_GET['sums'] <= 0) {
|
|
|
|
|
$err = '<b style="color: Red;">Введите сумму</b>';
|
|
|
|
|
} else {
|
|
|
|
|
$err = '<b style="color: Red;">Недостаточно средств</b>';
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$err = '<b style="color: Red;">У Вас нет прав на выполнение данной операции</b>';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if($_GET['addecredits']) {
|
|
|
|
|
if($clan_acces[7][0] == 1) {
|
|
|
|
|
if(isset($banks['id'])) {
|
|
|
|
|
if($banks['ekr'] >= (int)$_GET['sums'] && $_GET['sums'] > 0) {
|
|
|
|
|
if(isset($_GET['comment']) && $_GET['comment'] != '') {
|
|
|
|
|
$banks['ekr'] -= (int)$_GET['sums'];
|
|
|
|
|
$clan['ekr'] += (int)$_GET['sums'];
|
|
|
|
|
$text = mysql_real_escape_string(iconv("utf-8", "utf-8", $_GET['comment']));
|
|
|
|
|
mysql_query('UPDATE `bank` SET `ekr` = "'.$banks['ekr'].'" WHERE `id` = "'.$banks['id'].'" LIMIT 1');
|
|
|
|
|
mysql_query('UPDATE `clans` SET `ekr` = "'.$clan['ekr'].'" WHERE `id` = "'.$clan['id'].'" LIMIT 1');
|
|
|
|
|
mysql_query("INSERT INTO `delo` (`author`, `pers`, `text`, `type`, `date`) VALUES ('0', '{$user['id']}', '\"".$user['login']."\" Пополнил казну клана: ($clan[name] / $clan[id]) на сумму: ".(int)$_GET['sums']." екр, со счёта : $banks[id]. С пометкой : $text', '1', '".time()."')");
|
|
|
|
|
mysql_query('INSERT INTO `clan_log` (`clan_id`, `user_id`, `time`, `type`, `suma`, `comment`) VALUES ("'.$clan['id'].'", "'.$user['id'].'", "'.time().'", "2", "'.(int)$_GET['sums'].'", "'.$text.'")');
|
|
|
|
|
$err = '<b style="color: Red;">Казна пополненна на '.(int)$_GET['sums'].' eкр.</b>';
|
|
|
|
|
} else {
|
|
|
|
|
$err = '<b style="color: Red;">Введите комментарий</b>';
|
|
|
|
|
}
|
|
|
|
|
} elseif($_GET['sums'] <= 0) {
|
|
|
|
|
$err = '<b style="color: Red;">Введите сумму</b>';
|
|
|
|
|
} else {
|
|
|
|
|
$err = '<b style="color: Red;">Недостаточно средств</b>';
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$err = '<b style="color: Red;">Авторизируйтесь в банковском счету</b>';
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$err = '<b style="color: Red;">У Вас нет прав на выполнение данной операции</b>';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function form_pay($us, $clan) {
|
2018-01-28 21:22:28 +00:00
|
|
|
|
global $clan_acces $banks;
|
|
|
|
|
|
2018-01-28 16:40:49 +00:00
|
|
|
|
$user = mysql_fetch_array(mysql_query('SELECT `id`, `login`, `level`, `money` FROM `users` WHERE `id` = "'.$us.'" LIMIT 1'));
|
|
|
|
|
$r = '';
|
|
|
|
|
if($clan_acces[7][0] == 1) {
|
|
|
|
|
$r .= 'У Вас в наличии : <b>'.$user['money'].'</b> .кр<br />';
|
|
|
|
|
$r .= '<a href="javascript: void(0);" onclick="addCredits();">Пополнить (кредиты)</a><br />';
|
|
|
|
|
if(isset($banks['id'])) {
|
|
|
|
|
$r .= '<br />Счёт #'.$banks['id'].': <b>'.$banks['cr'].'</b> .кр и <b>'.$banks['ekr'].'</b> .екр<br />';
|
|
|
|
|
$r .= '<a href="javascript: void(0);" onclick="addeCredits();">Пополнить (еврокредиты)</a>';
|
|
|
|
|
} else {
|
|
|
|
|
$r .= '<br />Авторизируйтесь в банке через Инвентарь';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return $r;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
?>
|
|
|
|
|
<script>
|
|
|
|
|
function proverka(input) {
|
|
|
|
|
input.value = input.value.replace(/[^\d]/g, '');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function addCredits() {
|
|
|
|
|
new miDialog({title : 'Пополнить казну кредитами'}, {addcredits : 1}, function() {
|
|
|
|
|
document.location = '/__modules/clan_panel.php?razdel=kazna&'+$.param(this.data);
|
|
|
|
|
},
|
|
|
|
|
$('<div>Комментарий</div>').append(miDialog._simpleInput({name : 'comment'})).append('<div>Сумма</div>').append(miDialog._oneInput({name : 'sums', onkeyup : 'return proverka(this);', onchange : 'return proverka(this);', value : '0'})), {width : 280});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function addeCredits() {
|
|
|
|
|
new miDialog({title : 'Пополнить казну еврокредитами'}, {addecredits : 1}, function() {
|
|
|
|
|
document.location = '/__modules/clan_panel.php?razdel=kazna&'+$.param(this.data);
|
|
|
|
|
},
|
|
|
|
|
$('<div>Комментарий</div>').append(miDialog._simpleInput({name : 'comment'})).append('<div>Сумма</div>').append(miDialog._oneInput({name : 'sums', onkeyup : 'return proverka(this);', onchange : 'return proverka(this);', value : '0'})), {width : 280});
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
<table width="100%" border="0">
|
|
|
|
|
<tbody>
|
|
|
|
|
<tr>
|
|
|
|
|
<td align="center">
|
|
|
|
|
<table valign="top" align="center" width="100%">
|
|
|
|
|
<tbody>
|
|
|
|
|
<tr>
|
|
|
|
|
<td><br />
|
|
|
|
|
<center><br />
|
2018-01-28 21:22:28 +00:00
|
|
|
|
<?php if($err != '') { echo $err.'<br />'; } ?>
|
2018-01-28 16:40:49 +00:00
|
|
|
|
<b>Клановая казна: <font color="#339900"><?=$clan['money']; ?></font> кр, <font color="#339900"><?=$clan['ekr']; ?></font> екр.</b><br /><br />
|
|
|
|
|
<fieldset style="width: 300px; height: 100px;">
|
|
|
|
|
<legend align="center"><b>Пополнить казну:</b></legend>
|
2018-01-28 21:22:28 +00:00
|
|
|
|
<?php if($clan_acces[7][0] == 1) { echo form_pay($user['id'], $clan['id']); } else { echo '<b>Вы не можете пополнять казну</b>'; } ?>
|
2018-01-28 16:40:49 +00:00
|
|
|
|
</fieldset>
|
2018-01-28 21:22:28 +00:00
|
|
|
|
<?php if($clan_acces[6][0] == 1) { ?>
|
2018-01-28 16:40:49 +00:00
|
|
|
|
<a href="http://capitalcity.old-dark.ru/clan_log.php?act=caznalog&clan=<?=$clan['id'];?>&hash=<?=md5($user['id'].'|'.$user['login']);?>" target="_blank">Просмотр действий с казной</a>
|
|
|
|
|
<? } ?>
|
|
|
|
|
</center>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|