<?php
define('ROOT','../');
define('GCMS',true);
require_once (ROOT.'system/power.php');
if ($aut == true) {
if ($id) {
$type = $db -> query("SELECT `id` FROM `faq`");
if ($type -> num_rows > 0) $the = $type -> fetch_assoc(); else $the = false;
} else $the = false;
$diz -> head('ЧЗВ (FAQ)');
$diz -> title('ЧЗВ (FAQ)');
$count = $db -> dbcount('COUNT(`id`)','faq');
$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;
$posts = $db -> query("SELECT `id` FROM `faq`");
if ($posts -> num_rows > 0) {
$for = $db -> query("SELECT * FROM `faq` ORDER BY `sid` DESC LIMIT ".$start.",".$num);
while ($assoc = $for -> fetch_assoc()) {
$msg .= '<div class="top"><a href="faq'.$assoc['id'].'">'.$assoc['name'].'</a></div>';
}
}else{$msg.='<div class="fon">Инфо-ии пока нет!</div>';}
$act = './?id='.$id;
$msg .= ''.$func -> pagenav($act,$page,$total).'';

$msg .= '<div class="levo">
'.$diz -> img('back.png').'<a href="./">Назад</a></br>
'.$diz -> img('home.png').'<a href="/index.php">На главную</a></div>';
#####Копирайт#######
require_once (ROOT.'system/kopy.php');
$diz -> out($msg);
} else header('location: '.ROOT.'aut.php');
?>