Размер файла: 1.41Kb
<?php
$title = 'Новости сайта';
require("../system/core.php");
switch($_GET['act']){
default:
echo '<div class="phdr">' .$lng ['list'] . ' </div><div class="bmenu">';
$result = mysql_query("SELECT * FROM `news` ORDER BY `time` DESC LIMIT 20");
$row = mysql_fetch_assoc($result);
if($row > 0){
do
{
printf('<a href="news.php?act=view&id=%s">%s</a> (%s)<br/>', $row['id'], $row['title'], date('d.m.Y / H:i', $row['time']));
}
while($row = mysql_fetch_assoc($result));
}else{
echo 'Новостей пока нет';
}
echo '</div><div class="phdr"></div><div class="bmenu"><a href="../">' .$lng ['niz'] . ' </a></div>';
break;
case 'view':
$id = sec($_REQUEST['id']);
$row = mysql_fetch_assoc(mysql_query("SELECT * FROM `news` WHERE `id` = '$id'"));
if(isset($row['id'])){
echo '<div class="phdr">'.$row['title'].'</div><div class="bmenu">'.$row['text'].'<br/><br/><i>' .$lng ['datas'] . ' : '.date('d.m.y / H:i', $row['time']).'</i></div>';
echo '<div class="phdr"></div><div class="bmenu"><a href="./news.php">' .$lng ['news'] . ' </a><br/><a href="../">' .$lng ['niz'] . ' </a></div>';
}else{
echo '<div class="phdr">' .$lng ['err'] . ' </div><div class="bmenu">' .$lng ['log'] . ' </div>';
echo '<div class="phdr"></div><div class="bmenu"><a href="./">' .$lng ['news'] . ' </a><br/><a href="../">' .$lng ['niz'] . ' </a></div>';
}
}
require("../system/end.php");
?>