2018-02-27 03:53:10 +00:00
|
|
|
|
<?php
|
2018-01-28 16:40:49 +00:00
|
|
|
|
ob_start("ob_gzhandler");
|
|
|
|
|
session_start();
|
2019-01-28 15:56:35 +00:00
|
|
|
|
|
2020-07-03 10:26:38 +00:00
|
|
|
|
if (is_null($_SESSION['uid'])) {
|
|
|
|
|
header("Location: index.php");
|
|
|
|
|
}
|
2018-12-12 11:59:29 +00:00
|
|
|
|
require_once "functions.php";
|
2018-12-12 19:55:33 +00:00
|
|
|
|
if ($user['room'] != 29) {
|
|
|
|
|
header("Location: main.php");
|
|
|
|
|
die();
|
|
|
|
|
}
|
2018-02-27 03:53:10 +00:00
|
|
|
|
if ($user['battle'] != 0) {
|
|
|
|
|
header('location: fbattle.php');
|
|
|
|
|
die();
|
|
|
|
|
}
|
2020-07-03 10:26:38 +00:00
|
|
|
|
const BANK_SESSION_NAME = "bankid";
|
|
|
|
|
$get = urldecode(filter_input(INPUT_SERVER, 'QUERY_STRING'));
|
|
|
|
|
if ($get == 'exit') {
|
|
|
|
|
$_SESSION[BANK_SESSION_NAME] = null;
|
|
|
|
|
}
|
|
|
|
|
$bank = new Bank($_SESSION['uid']);
|
2018-01-28 16:40:49 +00:00
|
|
|
|
|
2020-07-03 10:26:38 +00:00
|
|
|
|
if (isset($_POST['userlogin'])) {
|
|
|
|
|
$_SESSION[BANK_SESSION_NAME] = $bank->user_id;
|
|
|
|
|
}
|
|
|
|
|
if ($_SESSION[BANK_SESSION_NAME]) {
|
|
|
|
|
$toid = (int)$_POST['to_id'] ?? 0;
|
|
|
|
|
$summa = (int)$_POST['summa'] ?? 0;
|
|
|
|
|
$submit = $_POST['action'] ?? '';
|
|
|
|
|
|
|
|
|
|
// Зачисдение кредитов на счёт.
|
|
|
|
|
if ($submit === 'depositMoney' && $summa) {
|
|
|
|
|
$bank->depositMoney($summa);
|
|
|
|
|
unset($submit, $summa);
|
|
|
|
|
}
|
2018-01-28 16:40:49 +00:00
|
|
|
|
|
2020-07-03 10:26:38 +00:00
|
|
|
|
// Снятие кредитов со счёта.
|
|
|
|
|
if ($submit === 'withdrawMoney' && $summa) {
|
|
|
|
|
$bank->withdrawMoney($summa);
|
|
|
|
|
unset($submit, $summa);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Перевод кредитов на другой счёт.
|
|
|
|
|
if ($submit === 'sendMoney' && $summa && $toid) {
|
|
|
|
|
$bank->sendMoney($toid, $summa);
|
|
|
|
|
unset($submit, $summa, $toid);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
?>
|
2018-02-27 03:53:10 +00:00
|
|
|
|
<!DOCTYPE html>
|
2020-07-03 10:26:38 +00:00
|
|
|
|
<html lang="ru">
|
2018-02-27 03:53:10 +00:00
|
|
|
|
<head>
|
|
|
|
|
<meta charset="utf-8">
|
|
|
|
|
<link href="css/main.css" rel="stylesheet"/>
|
2018-12-12 11:59:29 +00:00
|
|
|
|
<link href="css/secondary.css" rel="stylesheet"/>
|
2019-01-15 11:54:44 +00:00
|
|
|
|
<script src="js/main.js"></script>
|
2018-02-27 03:53:10 +00:00
|
|
|
|
<title>Банк</title>
|
2018-01-28 16:40:49 +00:00
|
|
|
|
</head>
|
2018-02-27 03:53:10 +00:00
|
|
|
|
<body>
|
2018-02-27 05:41:56 +00:00
|
|
|
|
<h1>Банк</h1>
|
2020-07-03 10:26:38 +00:00
|
|
|
|
<?php if (!$_SESSION[BANK_SESSION_NAME]): ?>
|
2019-01-15 19:34:35 +00:00
|
|
|
|
<a href=# onclick=hrefToFrame('city.php?strah')> ← выйти из банка</a>
|
2018-03-09 22:34:51 +00:00
|
|
|
|
<form method="post"><input type="submit" name="userlogin" value="Управление счётом"></form>
|
2020-07-03 10:26:38 +00:00
|
|
|
|
<?php else: ?>
|
2018-03-22 21:26:43 +00:00
|
|
|
|
<p><a href="?exit"> ← выйти из счёта</a></p>
|
2020-07-03 10:26:38 +00:00
|
|
|
|
<div><?= $bank->status ?></div>
|
2018-12-12 11:59:29 +00:00
|
|
|
|
<div class="appblock appblock-main">
|
2020-07-03 10:26:38 +00:00
|
|
|
|
<span class="legend">Cчет №<?= $bank->user_id ?></span>
|
|
|
|
|
<span class="wrap">На счету: <span class="num"><?= $bank->money ?></span></span>
|
2018-12-12 19:55:33 +00:00
|
|
|
|
<hr>
|
2020-07-03 10:26:38 +00:00
|
|
|
|
<span class="wrap">На руках: <span class="num"><?= $user['money'] ?></span></span>
|
2018-03-22 22:27:08 +00:00
|
|
|
|
</div>
|
2018-02-27 05:14:11 +00:00
|
|
|
|
<div class="appblock">
|
2018-03-22 22:35:17 +00:00
|
|
|
|
<span class="legend">Работа со счётом</span>
|
2018-03-09 21:12:03 +00:00
|
|
|
|
<form method="post">
|
|
|
|
|
<input size="10" name="summa" placeholder="Сумма">
|
2020-07-03 10:26:38 +00:00
|
|
|
|
<input type="hidden" name="action" value="depositMoney">
|
2018-03-22 22:35:17 +00:00
|
|
|
|
<input type="submit" value="Положить деньги">
|
2018-03-09 21:12:03 +00:00
|
|
|
|
</form>
|
|
|
|
|
<form method="post">
|
|
|
|
|
<input size="10" name="summa" placeholder="Сумма">
|
2020-07-03 10:26:38 +00:00
|
|
|
|
<input type="hidden" name="action" value="withdrawMoney">
|
2018-03-22 22:35:17 +00:00
|
|
|
|
<input type="submit" value="Снять деньги">
|
2018-03-09 21:12:03 +00:00
|
|
|
|
</form>
|
2018-02-27 05:14:11 +00:00
|
|
|
|
</div>
|
2018-03-09 22:01:20 +00:00
|
|
|
|
<div class="appblock">
|
2018-03-22 22:27:08 +00:00
|
|
|
|
<span class="legend">Перевод кредитов</span>
|
2018-03-09 21:12:03 +00:00
|
|
|
|
<form method="post">
|
|
|
|
|
<input size="10" name="summa" placeholder="Сумма">
|
2018-03-09 22:12:59 +00:00
|
|
|
|
<input size="10" name="to-id" placeholder="Cчёт"><br>
|
2020-07-03 10:26:38 +00:00
|
|
|
|
<input type="hidden" name="action" value="sendMoney">
|
2018-03-09 22:16:41 +00:00
|
|
|
|
<input type="submit" value="Перевести кредиты">
|
2018-02-27 05:14:11 +00:00
|
|
|
|
</form>
|
2018-03-22 22:35:17 +00:00
|
|
|
|
<span class="wrap">Комиссия: 5% от переводимой суммы, но не менее 1 кр.</span>
|
2018-02-27 05:14:11 +00:00
|
|
|
|
</div>
|
2020-07-03 10:26:38 +00:00
|
|
|
|
<?php endif; ?>
|
2018-01-28 16:40:49 +00:00
|
|
|
|
</body>
|
|
|
|
|
</html>
|