<?php
define('ROOT','../');
define('GCMS',true);
require_once (ROOT.'system/power.php');
if ($aut == true) {
if ($id) {
$type = $db -> query("SELECT * FROM `books` WHERE `id` = '".$id."'");
if ($type -> num_rows > 0) $the = $type -> fetch_assoc(); else $the = false;
} else $the = false;
//Выводим мои статьи
$diz -> head('Мои статьи');
$m_tems = $db -> dbcount('count(`id`)','books',"`user` = '".$ya['id']."'");
$diz -> title("<b>Мои статьи</b> ($m_tems)");
$count = $db -> dbcount('COUNT(`id`)','books',"`user` = '".$ya['id']."'");
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;
$for = $db -> query("SELECT * FROM `books` WHERE `user` = '".$ya['id']."' order by `time` DESC LIMIT ".$start.",".$num);
while ($assoc = $for -> fetch_assoc()) {
$poster = $db -> dbcount('login','users',"`id` = '".$who[0]."'");
$tot = intval(($cid - 1) / $num) + 1;
$msg .= '<div class="top"><a href="book'.$assoc['id'].'">'.$assoc['name'].'</a> (Прочитано '.$assoc['red'].' раз.)
</a><br/>'.$poster.'    '.$func -> times(date('d m Y в H:i',$assoc['time'])).'</div>';
}
$act = 'my_st.php?';
$msg .= ''.$func -> pagenav($act,$page,$total).'';
} else {
$msg .= '<div class="fon">У вас нет ни одной статьи!</div>';
}
}else {header('location: ../aut.php');}
$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);
?>