<?php
define('PROTECTOR', 1);

$headmod = 'news';//фикс. места

$textl='Новости';
include('files/path.php');
include($path.'files/db.php');
include($path.'files/auth.php');
include($path.'files/func.php');
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 "Ошибка!<br/>";
}
else {
$asd = mysql_query("SELECT title, text, time FROM news ORDER BY id DESC LIMIT $num,10");
while($dsa = mysql_fetch_array($asd))
{
$i2 = $i++;
$title = strip_tags($dsa['title']);
$text = strip_tags($dsa['text']);
$time = strip_tags($dsa['time']);
echo "<b>$title</b><small><b>[$time]</b></small><br/>$text<br/>------<br/>";
}
if ($_GET[page] > 0)
{
echo "<a href=\"news.php?page=$back\">back</a>";
}
elseif ($_GET[page] == 0)
{
echo "back";
}
echo"|";
if($_GET[page] < $puslap || $_GET[page] == "" || $_GET[page] == 0)
{echo "<a href=\"news.php?page=$next&\">next</a><br/>";}
else
{echo "next<br/>";}
}
echo"<a href=\"index.php?\">Назад</a>";

include($path.'files/down.php');
?>
