Файл: admin/back.php
Строк: 82
<?php
$title = 'Заявки на вывод';
require_once($_SERVER["DOCUMENT_ROOT"]."/inc/head.php");
if ($adm_id == 1) {
echo '<div class="title">Заявки на вывод ('.$count_payment.')</div>';
$stmt_num = $connect->prepare("select count(*) from `payment` where `id` = ?");
$strow = $connect->prepare("select * from `payment` where `id` = ?");
$stmt = $connect->prepare("update `payment` set `time` = ?, `status` = ? where `id` = ?");
if (isset($_GET['yes'])) {
$stmt_num->execute(array($_GET['yes']));
if ($stmt_num->fetchColumn()) {
$strow->execute(array($_GET['yes']));
$row = $strow->fetch();
if (isset($_POST['ok'])) {
if ($stmt->execute(array(time(), 1, $_GET['yes']))) {
notification('Ваша заявка на вывод средств ('.rub($row['money']).') успешно выполнена!', $row['uid']);
ratingUser($sys['rating']['minus'], $row['uid']);
header('Location: /adm/back');
} else {
echo '<div class="menu">Произошла ошибка!</div>';
}
}
elseif (isset($_POST['cancel'])) {
header('location: /adm/back');
}
echo '<div class="menu">
<form action="" method="POST">
<input type="submit" name="ok" value="Выполнить ('.intval($_GET['yes']).')"/>
<input type="submit" name="cancel" value="Отмена"/>
</form></div>';
} else {
header('location: /adm/back');
}
}
elseif (isset($_GET['no'])) {
$stmt_num->execute(array($_GET['no']));
if ($stmt_num->fetchColumn()) {
$strow->execute(array($_GET['no']));
$row = $strow->fetch();
if (isset($_POST['ok'])) {
if ($stmt->execute(array(time(), 2, $_GET['no']))) {
notification('Вам отказано в выплате!', $row['uid']);
header('Location: /adm/back');
} else {
echo '<div class="menu">Произошла ошибка!</div>';
}
}
elseif (isset($_POST['cancel'])) {
header('location: /adm/back');
}
echo '<div class="menu">
<form action="" method="POST">
<input type="submit" name="ok" value="Отказать ('.intval($_GET['no']).')"/>
<input type="submit" name="cancel" value="Отмена"/>
</form></div>';
} else {
header('location: /adm/back');
}
}
if ($count_payment == 0){
echo '<div class="menu">NONE</div>';
} else {
$page = new Pagination($count_payment, 10);
$data = $connect->prepare("select * from `payment` where `status` = '0' order by `id` desc limit :start, 10");
$data->bindValue(':start', $page->start, PDO::PARAM_INT);
$data->execute();
$sql = $data->fetchAll();
foreach ($sql as $row) {
echo '<div class="menu">
Кошелек: <img src="/img/wmr.png" alt="wmr">'.$row['wmr'].'<br/>
Сумма: '.rub($row['money']).'<br/>
Пользователь: '.profileLink($row['uid']).'
<div class="butt2">
<a href="?yes='.$row['id'].'">Выполнить</a>
<a href="?no='.$row['id'].'">Отказать</a>
</div>
</div>';
}
$page->navigation();
}
} else {
header ('location: /');
}
require($_SERVER["DOCUMENT_ROOT"]."/inc/foot.php");
?>