140 lines
6.4 KiB
PHP
140 lines
6.4 KiB
PHP
<?php
|
|
if (!defined('GAME') || !$u->info['bukmeker'] && !$u->info['admin']) {
|
|
die();
|
|
}
|
|
$pl = mysql_fetch_array(mysql_query('SELECT * FROM `bank_table` ORDER BY `time` DESC LIMIT 1'));
|
|
$ba = mysql_fetch_array(mysql_query("SELECT * FROM `bank_alh` WHERE `uid` = " . $u->info['id']));
|
|
?>
|
|
<script>
|
|
let elem = document.getElementById('se-pre-con');
|
|
elem.parentNode.removeChild(elem);
|
|
</script>
|
|
<script type="text/javascript" src='https://img.new-combats.com/js/commoninf.js'></script>
|
|
<style>
|
|
.modpow {
|
|
background-color: #ddd5bf;
|
|
}
|
|
|
|
.mt {
|
|
background-color: #b1a993;
|
|
padding: 5px 10px;
|
|
}
|
|
|
|
.md {
|
|
padding: 10px;
|
|
}
|
|
</style>
|
|
<h4>Панель Букмекера</h4>
|
|
<div style="float: right">
|
|
Привет, <?= $u->info['login'] ?>.
|
|
<INPUT TYPE="button" onclick="location.href='main.php?bukmeker=1';" value="Обновить" class="btn"
|
|
title="Обновить">
|
|
<INPUT TYPE="button" onclick="location.href='main.php';" class="btn" value="Вернуться" title="Вернуться">
|
|
</div>
|
|
|
|
|
|
<?php
|
|
if (isset($ba['id'])): ?>
|
|
<table width=320>
|
|
<tr>
|
|
<td>
|
|
<h4>Доступно</h4>
|
|
<b><?= $ba['cr'] ?></b> кр.
|
|
<hr/>
|
|
<form method="post" action="main.php?bukmeker=1">
|
|
<?
|
|
if (isset($_POST['buy_cr'])) {
|
|
$uba = mysql_fetch_array(
|
|
mysql_query(
|
|
'SELECT * FROM `users` WHERE `login` = "' . mysql_real_escape_string(
|
|
$_POST['buy_cr']
|
|
) . '" LIMIT 1'
|
|
)
|
|
);
|
|
if (isset($uba['login'])) {
|
|
echo 'Переводим кр персонажу: ' . $u->microLogin($uba['id'], 1) . '<br>';
|
|
} else {
|
|
echo '<span style="color: red; ">Банковский счет заблокирован, либо не найден.</span><hr>';
|
|
unset($_POST['buy_cr']);
|
|
}
|
|
echo '<hr>';
|
|
if (isset($uba['login'])) {
|
|
$_POST['buk_cr'] = round($_POST['buk_cr'], 2);
|
|
if (isset($_POST['buk_cr']) && $_POST['buk_cr'] < 1) {
|
|
echo '<span style="color: red; ">Минимальная сумма перевода: 1 кр.</span><hr>';
|
|
unset($_POST['buk_cr']);
|
|
} elseif ($_POST['buk_cr'] > $ba['cr']) {
|
|
echo '<span style="color: red; ">Недостаточно средств на счете</span><hr>';
|
|
unset($_POST['buk_cr']);
|
|
}
|
|
if (isset($_POST['buygoodluck'])) {
|
|
echo '<script>alert("Зачислено ' . $_POST['buk_cr'] . ' кр!");location.href="main.php?bukmeker=1";</script>';
|
|
$ba['cr'] -= $_POST['buk_cr'];
|
|
$ba['USD'] += round($_POST['buk_cr'] * $ucur, 2);
|
|
mysql_query(
|
|
'UPDATE `bank_alh` SET `cr` = "' . mysql_real_escape_string(
|
|
$ba['cr']
|
|
) . '",`USD` = "' . mysql_real_escape_string(
|
|
$ba['USD']
|
|
) . '" WHERE `id` = "' . $ba['id'] . '" LIMIT 1'
|
|
);
|
|
mysql_query(
|
|
'UPDATE `users` SET `money` = `money` + ' . mysql_real_escape_string(
|
|
$_POST['buk_cr']
|
|
) . ' WHERE `login` = "' . $uba['login'] . '" LIMIT 1'
|
|
);
|
|
|
|
$money = round($_POST['buk_cr'] * $pl['cur'], 2);
|
|
$money = round($money / 100 * (100 - $ba['procent']), 2);
|
|
|
|
} else {
|
|
echo 'Сумма кр.:';
|
|
if (!isset($_POST['buk_cr'])) {
|
|
echo ' <input name="buk_cr" style="width:50px;" value="0.00" /> <input class="btn btn-success" value="Далее" type="submit" /><br>';
|
|
} else {
|
|
echo ' <b>' . round(
|
|
(int)$_POST['buk_cr'], 2
|
|
) . '</b> кр.<input name="buk_cr" type="hidden" value="' . $_POST['buk_cr'] . '" />';
|
|
echo ' <input type="submit" name="buygoodluck" class="btn btn-danger" value="Начислить кр">';
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if (isset($_POST['buy_cr'])) { ?><input name="buy_cr" type="hidden"
|
|
value="<?= $_POST['buy_cr'] ?>" /> <?
|
|
} else { ?>Перевести кр персонажу: <input name="buy_cr" style="width:50px;"
|
|
value="<?= $_POST['buy_cr'] ?>"/> <input
|
|
class="btn btn-success" value="Далее" type="submit"/><?
|
|
} ?>
|
|
</form>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<?php
|
|
endif;
|
|
|
|
if (!$u->info['bukmeker'] && !$u->info['admin']) {
|
|
return;
|
|
}
|
|
if (!empty($_POST['systemM'])) {
|
|
$cmsg = new ChatMessage();
|
|
$cmsg->setLogin('Букмекерская контора');
|
|
$cmsg->setType(6);
|
|
$cmsg->setText($_POST['sysMes']);
|
|
$cmsg->setIsAlert(true);
|
|
(new Chat())->sendMsg($cmsg);
|
|
|
|
echo "<br><b style='color: red;'>Системное сообщение отправлено.</b>";
|
|
}
|
|
?>
|
|
<div style="width: 500px;">
|
|
<form method='POST'>
|
|
<label>Системка в чат: <br>
|
|
<textarea name="sysMes" rows="4" cols="80"></textarea>
|
|
</label>
|
|
<br>
|
|
<input type='submit' name='systemM' class='btn' value='Отправить'>
|
|
</form>
|
|
</div>
|