Файл: __system/pages/news.php
Строк: 32
<?
DEFINE('TITLE' , 'Новости'); # фиксируем титул
head();
if(isset($_GET['deleteNews']) and !empty($_GET['id']) and user('access') == 5)
{
$news = $db -> query
("
SELECT `id` FROM `news` WHERE `id` = '".filtration::int($_GET['id'])."' LIMIT 1
");
if($news -> rowCount() == 1)
{
$deleteNews = $db->exec("DELETE FROM `news` WHERE `id` = '".filtration::int($_GET['id'])."' LIMIT 1 ");
}
}
$news = $db -> query
("
SELECT * FROM `news` ORDER BY `id` ASC
");
if($news -> rowCount() > 0)
{
$start_limit = 1;
while($n = $news -> fetch(PDO::FETCH_ASSOC))
{
echo '<div class="main"><strong> '.$n['title'].' ('.$n['date'].')</strong>';
if(user('access') == 5)
{
echo ' ['.url('/news/deleteNews/'.$n['id'].'/','удалить','','').']</div>';
echo'</div>';
}
echo'<div class="main">'.nl2br($n['news']).'<br/>- - -<br/>Добавил: '.userID('name',$n['userID']).'<br/></div>';
$start_limit++;
}
}
else
{
echo '<div class="main">Новостей нет</div>';
}
foot();
?>