File size: 1.5Kb
<?php
include 'includes/config.php';
include 'includes/connect.php';
include 'includes/admin.valid.php';
include 'includes/navigator.class.php';
include 'includes/function.php';
include 'themes/head.php';
$sql = mysql_query("SELECT COUNT(*) FROM `".$db_pref."news`");
$all = mysql_result($sql, 0, 0);
if (!empty($_USER['login'])) {
echo <<<HTML
<br />
<div class="m"><div class="t">
<a href="$home_url/admin.index.php"><font color="yellow">Админпанель</font></a>
</div></div>
<br />
HTML;
}
if ($all == '0') {
echo <<<HTML
<br />
<div class="m"><div class="t">
Новостей нет!
</div></div>
<br />
HTML;
}
if ($all) {
$n = new Navigator($all,$pnumber);
$sql = mysql_query("SELECT * FROM `".$db_pref."news` ORDER BY `id` DESC LIMIT {$n->start()},$pnumber ");
while ($row = mysql_fetch_assoc($sql)) {
$id = $row['id'];
$date = $row['date'];
$comm = $row['comm'];
$news = htmlspecialchars($row['news']);
$news = noslashes(stripcslashes(nl2br(parsebb($news))));
if (!empty($_USER['login'])) {
$adm = '[<a href="'.$home_url.'/news.del.php?id='.$id.'"><font color="red">del</font></a>] [<a href="'.$home_url.'/news.edit.php?id='.$id.'"><font color="yellow">edit</font></a>]';
}
echo <<<HTML
<div class="t">$date $adm</div>
<div class="m">
<div class="menu2">
$news
<br />[<a href="comment.php?news_id=$id">Комментарии</a> $comm]
</div></div>
HTML;
}
echo $n->navi();
}
include 'themes/foot.php';
?>