View file news.php

File size: 1.81Kb
<?php
####################
# Автор: [Svig]    #
# ICQ: 563000172   #
####################

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");
if (mysql_num_rows($result) > 0)
{
$myrow2 = mysql_fetch_array($result);

include ("head.php");
do {
include ("smiles/smiles.php");
echo "<div class='nav'>";
echo "<small>".$myrow2['date']." </small><br />";
echo " ".$myrow2['text']."<br /> ";
echo "</div>";
}
while ($myrow2 = 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>";

}
else
{
include ("head.php");
echo "<div class='nav'>";
echo "Новостей нет!<br />";
echo "</div>";
echo "<div class='nav'>";
echo "• <a href=menu.php?user=$user&pass=$pass>В меню</a>";
echo "</div>";
include ("foot.php");
exit();
}

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");
}
?>