game/modules_data/_bukmeker.php

140 lines
6.4 KiB
PHP
Raw Normal View History

<?php
if (!defined('GAME') || !$u->info['bukmeker'] && !$u->info['admin']) {
die();
2022-06-06 21:30:34 +00:00
}
$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']));
2022-06-06 21:30:34 +00:00
?>
<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;
}
2022-06-06 21:30:34 +00:00
.mt {
background-color: #b1a993;
2023-01-28 02:24:37 +00:00
padding: 5px 10px;
}
2022-06-06 21:30:34 +00:00
.md {
padding: 10px;
2022-06-06 21:30:34 +00:00
}
</style>
2023-01-10 16:29:32 +00:00
<h4>Панель Букмекера</h4>
<div style="float: right">
2023-01-10 16:29:32 +00:00
Привет, <?= $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>
2023-01-10 16:29:32 +00:00
<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'])) {
2023-01-10 16:29:32 +00:00
echo 'Переводим кр персонажу: ' . $u->microLogin($uba['id'], 1) . '<br>';
} else {
2023-01-28 02:24:37 +00:00
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) {
2023-01-28 02:24:37 +00:00
echo '<span style="color: red; ">Минимальная сумма перевода: 1 кр.</span><hr>';
unset($_POST['buk_cr']);
} elseif ($_POST['buk_cr'] > $ba['cr']) {
2023-01-28 02:24:37 +00:00
echo '<span style="color: red; ">Недостаточно средств на счете</span><hr>';
unset($_POST['buk_cr']);
}
if (isset($_POST['buygoodluck'])) {
2023-01-10 16:29:32 +00:00
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'
);
2022-06-06 21:30:34 +00:00
$money = round($_POST['buk_cr'] * $pl['cur'], 2);
$money = round($money / 100 * (100 - $ba['procent']), 2);
2022-06-06 21:30:34 +00:00
} else {
2023-01-10 16:29:32 +00:00
echo 'Сумма кр.:';
if (!isset($_POST['buk_cr'])) {
2023-01-10 16:29:32 +00:00
echo '&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <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
2023-01-10 16:29:32 +00:00
) . '</b> кр.<input name="buk_cr" type="hidden" value="' . $_POST['buk_cr'] . '" />';
echo ' &nbsp; <input type="submit" name="buygoodluck" class="btn btn-danger" value="Начислить кр">';
}
}
}
}
2022-06-06 21:30:34 +00:00
if (isset($_POST['buy_cr'])) { ?><input name="buy_cr" type="hidden"
value="<?= $_POST['buy_cr'] ?>" /> <?
2023-01-10 16:29:32 +00:00
} else { ?>Перевести кр персонажу: <input name="buy_cr" style="width:50px;"
value="<?= $_POST['buy_cr'] ?>"/> <input
2023-01-10 16:29:32 +00:00
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'])) {
2023-01-28 02:24:37 +00:00
$cmsg = new ChatMessage();
$cmsg->setLogin('Букмекерская контора');
$cmsg->setType(6);
$cmsg->setText($_POST['sysMes']);
$cmsg->setIsAlert(true);
(new Chat())->sendMsg($cmsg);
2023-01-10 16:29:32 +00:00
echo "<br><b style='color: red;'>Системное сообщение отправлено.</b>";
}
?>
<div style="width: 500px;">
<form method='POST'>
2023-01-10 16:29:32 +00:00
<label>Системка в чат: <br>
<textarea name="sysMes" rows="4" cols="80"></textarea>
</label>
<br>
2023-01-10 16:29:32 +00:00
<input type='submit' name='systemM' class='btn' value='Отправить'>
</form>
</div>