Файл: page/shop/basket.php
Строк: 41
<?php
$title = 'Корзина';
require_once($_SERVER["DOCUMENT_ROOT"]."/inc/head.php");
if (isset($active) && $sys['modules']['shop'] == 1) {
echo '<div class="title">Корзина ('.$user_bk.')</div>';
if (isset($_GET['del'])) {
$stmt_bk->execute(array($_GET['del'], $user['id']));
if ($stmt_bk->fetchColumn()) {
if (isset($_POST['yes'])) {
if ($del_basket->execute(array($_GET['del'], $user['id']))) {
header('Location: /shop/basket');
} else {
echo '<div class="menu">Произошла ошибка!</div>';
}
}
elseif (isset($_POST['no'])) {
header('Location: /shop/basket');
}
echo '<div class="menu">
<form action="" method="POST">
<input type="submit" name="yes" value="Удалить ('.intval($_GET['del']).')"/>
<input type="submit" name="no" value="Отмена"/>
</form></div>';
} else {
header('Location: /shop/basket');
}
}
if ($user_bk == 0) {
echo '<div class="menu">В корзине пусто.</div>';
} else {
$page = new Pagination($user_bk, 10);
$data = $connect->prepare("select * from `basket` where `uid` = :uid order by `id` desc limit :start, 10");
$data->bindValue(':uid', $user['id'], PDO::PARAM_INT);
$data->bindValue(':start', $page->start, PDO::PARAM_INT);
$data->execute();
$sql = $data->fetchAll();
foreach ($sql as $row) {
$linkShop = linkShop($row['pid']);
echo '<div class="menu">
'.($linkShop ? $linkShop :
'<div class="menu">DELETED</div>').'
<div class="forlink"><a href="?del='.$row['pid'].'" class="links"><img src="/img/del.png" alt="del">Удалить из корзины</a></div>
</div>';
}
$page->navigation();
}
echo '<div class="forlink"><a href="/shop" class="links"><img src="/img/shop.png" alt="">Магазин скриптов</a></div>';
} else {
header('Location: /');
}
require($_SERVER["DOCUMENT_ROOT"]."/inc/foot.php");
?>