Файл: 4mast/profmas.ru/pages/shop/incfiles/ustovc.php
Строк: 25
<?php
define('ROOT', $_SERVER['DOCUMENT_ROOT'].'/');
require_once(ROOT.'includes/Headers.php');
require_once(ROOT.'includes/PDO_func.php');
if (!isset($_GET['id'])) {
header ('location: /');
exit;
}
$query = DB::$dbs->query("SELECT * FROM `us` WHERE `id` = ?", [(int)$_GET['id']]);
if ($query -> rowCount () == 0) {
header ('location: /');
exit;
}
$u = $query -> fetch ();
H('FORMAST.RU | Товары ' . $u['nick'].'',' <center>Товары ' . $u['nick'].'</center>');
$count = DB::$dbs->querySingle("SELECT COUNT(id) FROM magazin_file WHERE user_id = ?", [$u['id']]);
$items_per_page = 10;
$pages = ceil($count/$items_per_page);
$page = (int)$_GET['page'];
if ($page < 1) $page = 1;
if ($page > $pages)
$page = $pages;
$start = $page * $items_per_page - $items_per_page;
if ($count == 0) {
echo '<div class="error">Товаров нет!</div>';
}
else {
$sql = DB::$dbs->query("SELECT * FROM magazin_file WHERE user_id = ? ORDER BY time DESC LIMIT $start, $items_per_page", [$u['id']]);
while($a = $sql->fetch()) {
echo '<div class="block"><a href="/pages/shop/file/'.$a['id'].'">'.$a['name'].' ('.datef($a['time']).') '.$New.'<br/>Стоимость: <b>'.$a['price'].' р.</b></a></div>';
}
echo '' .page('/pages/shop/ustovc/'.$u['id'].'?'). '';
}
require_once(ROOT.'includes/Footers.php');
?>