File size: 3.93Kb
<?php
$title = 'Заявки на вывод';
include_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']));
$num = $stmt_num->fetchColumn();
if ($num > 0) {
$strow->execute(array($_GET['yes']));
$row = $strow->fetch(PDO::FETCH_LAZY);
if (isset($_POST['ok'])) {
$status = 1;
if ($stmt->execute(array(time(), $status, $_GET['yes']))) {
notification('Ваша заявка на вывод средств успешно выполнена!', $row['user'], 1);
ratingUser($minus_r, $row['user'], 1);
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="Выполнить ('.val($_GET['yes'], 1).')"/>
<input type="submit" name="cancel" value="Отмена"/>
</form></div>';
} else {
header('location: /adm/back');
}
}
elseif (isset($_GET['no'])) {
$stmt_num->execute(array($_GET['no']));
$num = $stmt_num->fetchColumn();
if ($num > 0) {
$strow->execute(array($_GET['no']));
$row = $strow->fetch(PDO::FETCH_LAZY);
if (isset($_POST['ok'])) {
$status = 2;
if ($stmt->execute(array(time(), $status, $_GET['no']))) {
notification('Вам отказано в выплате!', $row['user'], 1);
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="Отказать ('.val($_GET['no'], 1).')"/>
<input type="submit" name="cancel" value="Отмена"/>
</form></div>';
} else {
header('location: /adm/back');
}
}
$k_post = $count_payment;
$k_page = k_page($k_post, 10);
$page = page($k_page);
$start = 10 * $page - 10;
$data = $connect->prepare("select * from `payment` where `status` = '0' order by `id` desc limit :start, 10");
$data->bindValue(':start', $start, PDO::PARAM_INT);
$data->execute();
$sql = $data->fetchAll();
if ($count_payment == 0){
echo '<div class="menu">NONE</div>';
} else {
foreach ($sql as $row) {
echo '<div class="menu">
Сумма: '.$row['money'].' WMR (<a href="?yes='.$row['id'].'">Выполнить</a>/<a href="?no='.$row['id'].'">Отказать</a>)<br/>
Кошелек: '.$row['wmr'].'<br/>
Пользователь: '.$row['user'].'
</div>';
}
if ($k_page > 1) navigation($k_page, $page);
}
if ($version == 'mobile') echo '<div class="forlink"><a href="/adm" class="links">Панель управления</a></div>';
} else {
header ('location: /');
}
include_once($_SERVER["DOCUMENT_ROOT"]."/inc/foot.php");
?>