<?php
define('ROOT','../');
define('GCMS',true);
require_once (ROOT.'system/power.php');
if ($aut) {
$diz -> head('Новые статьи');
$diz -> title('Новые статьи');
$count = $db -> dbcount('COUNT(`id`)','books','`time` > '.(time()-86400).'');
if ($count>0){
$num = isset($ya['num']) ? $ya['num'] : 10;
$total = intval(($count - 1) / $num) + 1; 
if (!isset($_GET['page']) || !is_numeric($_GET['page']) || $_GET['page'] < 1 )
{
$page = 1;
} elseif($_GET['page'] > $total)
{ $page = $total;
} else $page = (int)$_GET['page'];
$start = $page * $num - $num;
$sql = $db -> query("SELECT * FROM `books` where `time` > '".(time()-86400)."' ORDER BY `time` DESC LIMIT ".$start.",".$num);
while ($post = $sql -> fetch_assoc()) {
$user = $db -> query("SELECT login FROM `users` where `id`='".$post['user']."' ");
$us = $user -> fetch_assoc();
$msg .='<div class="top">Статья: <a href="./book'.$post['id'].'">'.$post['name'].'</a> (Прочитано '.$post['red'].' раз.)<br/>
<a href="../my/id'.$post['user'].'">'.$us['login'].'</a> 
('.$func -> times(date('d m Y в H:i',$post['time'])).')</div>';
}
$act = 'new_st.php?';
$msg .= $func -> pagenav($act,$page,$total);
}else{$msg .= '<div class="fon">Новых статей пока нет</div>';}
$msg .= '<div class="levo">'.$diz -> img('back.png').'<a href="./">Библиотека</a></br>';
$msg .= ''.$diz -> img('home.png').'<a href="/">На главную</a></div>';
#####Копирайт#######
require_once ('../system/kopy.php');
$diz -> out($msg);
} else {
header('location: ../aut.php');
}
?>