Файл: 4mast/profmas.ru/pages/shop/incfiles/newtovc.php
Строк: 21
<?php
define('ROOT', $_SERVER['DOCUMENT_ROOT'].'/');
require_once(ROOT.'includes/Headers.php');
require_once(ROOT.'includes/PDO_func.php');
H ('Новые товары', '<a href="/pages/shop" style="color:white;">Магазин</a> | Новые товары');
$count = DB::$dbs->querySingle("SELECT COUNT(id) FROM magazin_file");
$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 ORDER BY time DESC LIMIT $start, $items_per_page");
while($a = $sql->fetch()) {
$New = ($a['time'] > time()-86400 ? '<font color="red"><b>new</b></font>':NULL);
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/newtovc?'). '';
}
require_once(ROOT.'includes/Footers.php');
?>