File size: 1.33Kb
<?php
include ("conf.php");
include ("lock.php");
if ($user == $myrow["user"] && $pass == $myrow["pass"])
{
$at_page=5;
$count=mysql_result(mysql_query("SELECT COUNT(`id`) FROM `news`"), 0);
$pages=ceil($count/$at_page);
$page=abs(intval(@$_REQUEST['page']));
if($page==0) $page=1;
define('PAGE', $page);
unset($page);
$from=(PAGE-1)*$at_page;
$result=mysql_query("SELECT id,text,date FROM news ORDER BY `id` DESC LIMIT $from, $at_page");
$myrow = mysql_fetch_array($result);
include ("head.php");
do {
echo "<div class='nav'>";
echo "<small>".$myrow['date']." </small><br />";
echo " ".$myrow['text']."<br /> ";
echo "</div>";
}
while ($myrow = mysql_fetch_array ($result));
echo "<div class='nav'>";
if(PAGE>1) echo "<a href='news.php?page=".(PAGE-1)."&user=$user&pass=$pass'>Назад</a>";
if(PAGE<$pages) echo " <a href='news.php?page=".(PAGE+1)."&user=$user&pass=$pass'>Вперед</a>";
if($pages>1) echo "";
echo "</div>";
echo "<div class='nav'>";
echo "• <a href=menu.php?user=$user&pass=$pass>В меню</a>";
echo "</div>";
include ("foot.php");
exit();
}
else
{
include ("head.php");
echo "<div class='nav'>";
echo "Ошибка! <br />Неверный <b>Ник</b> или <b>Пароль</b>!<br />";
echo "</div>";
echo <<<sss
<div class='nav'>
<a href="index.php">На главную</a>
</div>
sss;
include ("foot.php");
}
?>