File size: 1.34Kb
<?php
include 'inc/db.php';
include 'inc/1.php';
$time=time();
function hc($in){
return htmlspecialchars($in);
}
function me($in){
return mysql_escape_string($in);
}
mysql_query("UPDATE `user` SET `news` = '1' WHERE `id` = '$user[id]'");
if (!$_GET['p'])$_GET['p']=1;
$page=intval($_GET['p']);
$start=($page*15-15);
$q=mysql_query("SELECT * FROM `news` ORDER BY `time` DESC LIMIT $start, 15");
$qq=mt_rand(1111, 9999);
$a=1;
while ($f=mysql_fetch_assoc($q)){
$ank=mysql_fetch_assoc(mysql_query("SELECT * FROM `user` WHERE `id` = '$f[user]'"));
$ololo=out($f['msg']);
echo "<div class='p".($a%2)."'>".im($ank['id'])." <a href='news.php?to=".hc($ank['name'])."'>".hc($ank['name'])."</a>".on($ank['id'])." (".vremja($f['time']).")<br>$ololo";
$kk=mysql_num_rows(mysql_query("SELECT `id` FROM `news_komm` WHERE `nid` = '$f[id]'"));
if ($user['admin']==1)echo "<br><img src='icon/razdel.gif'> <a href='nkomm.php?id=$f[id]'><b>Комментарии</b> ($kk)</a>";
if ($user['admin']==1)echo "<br><a href='?del=$f[id]'>[<font color='red'>x</font> Удалить]</a>";
echo "</div>";
$a++;
}
echo "<div align='center'>";
if ($page>1)echo "<a href='news.php?p=".($page-1)."'>Назад</a> ";
if (mysql_num_rows(mysql_query("SELECT * FROM `news`"))>($start+15)) echo "<a href='?p=".($page+1)."'>Далее</a>";
include_once 'inc/foot.php';
?>