<?
include 'mysql.php';
include_once("include/zag.php");
include 'include/ini.php';
include_once("include/sesi.php");
if (isset($user)) {
$novs = sizeof(file('MySql/base123/novs.dat'));
echo"Новостей - [$novs]<br/><hr>";
$file = @file("MySql/base123/novs.dat");
$total = count($file);

if (empty($_GET['start'])) $start = 0;
else $start = $_GET['start'];
if ($total < $start + 5){ $end = $total; }
else {$end = $start + 5; }
for ($i = $start; $i < $end; $i++){

$file = @file("MySql/base123/novs.dat");
$file = array_reverse($file);
$data = explode("||",$file[$i]);
$i2=round($i+1);

$id=$total-$i-1;
echo"<b>$data[0]</b> [$data[1]]<br/>$data[2]<br/>";
echo'<a href="koment.php?num='.$id.'&amp;'.$sd.'">Комментарий</a><br/><br/>';
}

if($total>0){

$ba=ceil($total/5);
$ba2=$ba*5-5;

$asd=$start-(5*3);
$asd2=$start+(5*4);

if($asd<$total && $asd>0){echo ' <a href="news.php?start=0&'.$sd.'">1</a> ... ';}
for($i=$asd; $i<$asd2;){
if($i<$total && $i>=0){
$ii=floor(1+$i/5);
if ($start==$i) {
echo ' <b>('.$ii.')</b>';
}else{
echo ' <a href="news.php?start='.$i.'&'.$sd.'">'.$ii.'</a>';
}}
$i=$i+5;}
if($asd2<$total){echo ' ... <a href="news.php?start='.$ba2.'&'.$sd.'">'.$ba.'</a>';}
}
}else{echo"<small>Пароль или логин неверен!</small>";}
include_once"include/down.php";
?>
