Размер файла: 2.31Kb
<?php
include '../header/config.inc.php';
include '../header/function.inc.php';
include '../header/header.inc.php';
include '../header/connect.inc.php';
include '../header/click-club.class.php';
If (!isset($_GET['log'])) define("anybody","true");
include '../header/enter.inc.php';
include '../ban.php';
@mysql_query("update `".prefix."users` set `mesto`='В новостях', `online`='".time()."' where `id` = '".$_USER['id']."';");
echo'<div class="downsw"><b>Новости</b></div>';
If ($_USER['admin']){ echo'<div class="menuindex"><a href="news.add.php"><b>Добавить</b></a></div>'; }
If (!isset($_GET['page']) || !is_numeric($_GET['page'])) $page=1;
else { $page=$_GET['page']; (int)$page;}
$result=@mysql_query("SELECT * FROM `news_news` ORDER by `id` desc LIMIT ".(($page-1)*num_best_on_page).",".(num_best_on_page+1));
If (!$result){
echo '<div class="menuindex">Oшибкa зaпpoca к бд...</div>';
break;
}
$next=false;
$num=mysql_num_rows($result);
If ($num>0){
If ($num<=num_best_on_page) $read=$num; else {
$read=num_best_on_page;
$next=true;
}
for ($i=0;$i<$read;$i++){
$id = ''.mysql_result($result,$i,'id').'';
$date = ''.mysql_result($result,$i,'date').'';
$comm = ''.mysql_result($result,$i,'comm').'';
$news = ''.mysql_result($result,$i,'news').'';
$news = smiles(parsebb(smile(antirek(antimat(stripslashes(nl2br($news)))))));
If ($_USER['admin']){$adm ='[<a href="news.del.php?id='.$id.'"><font color="red">del</font></a>] [<a href="news.edit.php?id='.$id.'"><font color="green">edit</font></a>]'; }
echo'
<div class="menuindex"><img src="/rss.gif"> <b>'.$date.'</b> '.$adm.'</div>
<div class="menuindex">
'.$news.'
<br /><a href="comment.php?news_id='.$id.'">Комментарии</a> ['.$comm.']
</div>
';
}
echo '<div class="menuindex">';
If ($page>1) echo '<a href="'.$_zapros.'&page='.($page-1).'">';
echo '« Haзaд';
If ($page>1) echo '</a>';
echo ' | ';
If ($next) echo '<a href="'.$_zapros.'page='.($page+1).'">';
echo 'Дaлee »';
If ($next) echo '</a>';
echo '</div>';
} else echo '<div class="menuindex">Новостей еще нет!</div>';
If ($_USER['admin']){ echo'<div class="menuindex"><a href="comm.del.user.php"><b>Удалить все комментарии юзера</b></a></div>'; }
include "../header/end.inc.php";
?>