Файл: news.php
Строк: 27
<?php
include_once("files/zag.php");
include_once("files/ini.php");
$polz=mysql_query("SELECT * FROM `users` WHERE `udata0`='$log' AND `udata1`='$pas' LIMIT 1");
if(mysql_num_rows($polz)==0){
header ("Location: index.php?error");
echo'<div class="p">Ошибка! Пользователь с таким логином и паролем не зарегистрирован, или пароль/логин неверен! <a href="index.php">На главную</a><br>';exit;
}else{
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('files/down.php');
?>