2018-02-27 03:53:10 +00:00
|
|
|
|
<?php
|
2021-02-01 16:42:52 +00:00
|
|
|
|
|
|
|
|
|
use Battles\Bank;
|
|
|
|
|
|
2018-12-12 11:59:29 +00:00
|
|
|
|
require_once "functions.php";
|
2020-10-28 12:31:17 +00:00
|
|
|
|
|
2022-08-09 19:57:43 +00:00
|
|
|
|
$_POST['action'] ??= null;
|
|
|
|
|
$bank = new Bank();
|
2018-01-28 16:40:49 +00:00
|
|
|
|
|
2020-10-28 12:31:17 +00:00
|
|
|
|
// Зачисление кредитов на счёт.
|
2022-08-09 19:57:43 +00:00
|
|
|
|
if ($_POST['action'] === 'depositMoney' && !empty($_POST['summa'])) {
|
|
|
|
|
$bank->depositMoney($_POST['summa']);
|
|
|
|
|
}
|
2020-10-28 12:31:17 +00:00
|
|
|
|
// Снятие кредитов со счёта.
|
2022-08-09 19:57:43 +00:00
|
|
|
|
if ($_POST['action'] === 'withdrawMoney' && !empty($_POST['summa'])) {
|
|
|
|
|
$bank->withdrawMoney($_POST['summa']);
|
|
|
|
|
}
|
2020-10-28 12:31:17 +00:00
|
|
|
|
// Перевод кредитов на другой счёт.
|
2022-08-09 19:57:43 +00:00
|
|
|
|
if ($_POST['action'] === 'sendMoney' && !empty($_POST['summa']) && !empty($_POST['to-id'])) {
|
|
|
|
|
$bank->sendMoney($_POST['to-id'], $_POST['summa']);
|
2020-10-28 12:31:17 +00:00
|
|
|
|
}
|
2022-08-09 19:57:43 +00:00
|
|
|
|
|
|
|
|
|
require_once 'views/bank.php';
|