<?php
define('PROTECTOR', 1);
include('files/path.php');
include($path.'files/db.php');
include($path.'files/auth.php');
include($path.'files/func.php');
$textl='Новости';
include($path.'files/core.php');
include($path.'files/head.php');
include($path.'files/zag.php');

if ($_GET['page'] == "" || $_GET['page'] < 0 || $_GET['page'] == "0"){
$_GET['page'] = 0;
}
$next = $_GET['page'] + 1;
$back = $_GET['page'] - 1;
$num = $_GET['page'] * 10;
if($_GET['page'] == "0"){
$i = 1;
}else{
$i = ($_GET['page']*10)+1;
}
$viso = mysql_num_rows(mysql_query("SELECT `title` FROM `news`"));
$puslap = floor($viso/10);
if (is_double($num) || !is_integer($num)){
echo'<div class="main"><div class="block_zero">Ошибка!</div></div>';
}else{
$asd = mysql_query("SELECT `title`, `text`, `time` FROM `news` ORDER BY `id` DESC LIMIT $num,10");
While($dsa = mysql_fetch_array($asd)){
$title = strip_tags($dsa['title']);
$text = strip_tags($dsa['text']);
$time = strip_tags($dsa['time']);
echo'<div class="main"><div class="block_zero">'.$i.'. '.$title.' <small>('.$time.')</small></div><div class="dot-line"></div><div class="block_zero">'.$text.'</div><div class="mini-line"></div>';
$i++;
}
echo'<div class="block_zero center">';
//-----НАВИГАЦИЯ-----//
if ($_GET['page'] > 0){
echo'<a href="news.php?page='.$back.'"><< Назад - |</a>';
}

if($_GET['page'] < $puslap || $_GET['page'] == "" || $_GET['page'] == 0)
{
echo'<a href="news.php?page='.$next.'">| - Далее >></a>';
}
//-----КОНЕЦ НАВИГАЦИИ-----//
}
echo'</div></div><div class="dot-line"></div><div class="main"><div class="block_zero"><a href="javascript:history.go(-1)"><span style="color: #999;"><< Назад</span></a></div></div></div>';
include($path.'files/down.php');
?>