Файл: app/shop/payments.php
Строк: 37
<?php
if (!$user->isAuth()) {
redirect('/');
exit;
}
$method = $db->prepare('SELECT * FROM `method` WHERE `id` = ?');
$method -> execute([1]);
$method = $method -> fetch(PDO :: FETCH_OBJ);
$id = Clean:: int($_GET['id']);
$shop = $db->prepare('SELECT * FROM `shop` WHERE `id` = ? and `user` = ?');
$shop -> execute([$id,$user->get()->user_id]);
$shop = $shop -> fetch(PDO :: FETCH_ASSOC);
if(!isset($shop['id'])){
header('Location: /');
exit;
}
if(isset($_POST['submit'])){
$yandex = Clean::bool(trim($_POST['yandex']));
$qiwi = Clean::bool(trim($_POST['qiwi']));
$payeer = Clean::bool(trim($_POST['payeer']));
$mobile = Clean::bool(trim($_POST['mobile']));
$card = Clean::bool(trim($_POST['card']));
$balans = Clean::bool(trim($_POST['balans']));
$bitcoin = Clean::bool(intval($_POST['bitcoin']));
$litecoin = Clean::bool(intval($_POST['litecoin']));
$dash = Clean::bool(intval($_POST['dash']));
$vkpay = Clean::bool(intval($_POST['vkpay']));
$update = $db->prepare('UPDATE `shop` SET `yandex` = ?,
`qiwi` = ?,
`payeer` = ?,
`mobile` = ?,
`card` = ?,
`balans` = ?,
`bitcoin` = ?,
`litecoin` = ?, `dash` = ?, `vkpay` = ? WHERE `id` = ?');
$update -> execute([
$yandex,
$qiwi,
$payeer,
$mobile,
$card,
$balans,
$bitcoin,
$litecoin,
$dash,
$vkpay,
$shop['id']
]);
Notif :: message('Настройки платежных систем успешно изменены','/shop');
exit;
}
echo $template->render('shop.payments', ['shop' => $shop,
'method' => $method
]);