Просмотр файла index.php

Размер файла: 1.39Kb
<?php
include 'config.php';
$title = 'Новостная лента';
include 'head.php';
echo '<div class="head">Новости ресурса</div>';

$startan = $_GET['startan'];

if(empty($startan)) $startan = 0;
$startan=intval($startan);
if($startan<0) $startan=0; $num_msgs_an=5;
$arr = mysql_query("SELECT * from `news`");
$qi = mysql_query("SELECT * from `news` ORDER by `id` DESC LIMIT $startan,$num_msgs_an;;;");
if (mysql_affected_rows()==0)
{
echo '<div class="menu">';
echo "Новостей ещё нет!";
echo '</div>';
include 'foot.php';
exit();
}
else
{
while($row=mysql_fetch_array($qi))
{
$row = str_replace('&lt;br/&gt;', '<br/>', $row);
$row = str_replace('&lt;b&gt;', '<b>', $row);
$row = str_replace('&lt;/b&gt;', '</b>', $row);
$row = str_replace('&lt;u&gt;', '<u>', $row);
$row = str_replace('&lt;/u&gt;', '</u>', $row);
$row = str_replace('&lt;i&gt;', '<i>', $row);
$row = str_replace('&lt;/i&gt;', '</i>', $row);
$row = str_replace('&lt;/i&gt;', '</i>', $row);

echo '<div class="menu">';
echo '['.$row['date'].']<br/>';
echo ''.$row['text'].'<br/>';
echo '</div>';
}
}
echo '<div class="menu">';
$i = @mysql_num_rows($arr);
if($startan!=0)
echo '<a href="?startan='.($startan-$num_msgs_an).'">&laquo;</a> | ';
if($i>$startan+$num_msgs_an)
echo '<a href="?startan='.($startan+$num_msgs_an).'">&raquo;</a>';
echo '</div>';
include 'foot.php';
?>