battles/bank.php

24 lines
688 B
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
use Battles\Bank;
require_once "functions.php";
$_POST['action'] ??= null;
$bank = new Bank();
// Зачисление кредитов на счёт.
if ($_POST['action'] === 'depositMoney' && !empty($_POST['summa'])) {
$bank->depositMoney($_POST['summa']);
}
// Снятие кредитов со счёта.
if ($_POST['action'] === 'withdrawMoney' && !empty($_POST['summa'])) {
$bank->withdrawMoney($_POST['summa']);
}
// Перевод кредитов на другой счёт.
if ($_POST['action'] === 'sendMoney' && !empty($_POST['summa']) && !empty($_POST['to-id'])) {
$bank->sendMoney($_POST['to-id'], $_POST['summa']);
}
require_once 'views/bank.php';