File size: 1.88Kb
<?php
$title='Последние сообщения';
require"../system/config.php";
require"../system/func.php";
require"../system/head.php";
require"../system/error.php";
echo'<div class="i">'.$title.'<br></div>';
$total=mysql_num_rows(mysql_query("SELECT * FROM `forum_themes`"));
$page = abs((int)$_GET['page']);
if($page < 0 || $page > $total) $page = 0;
if ($total < $page + 10) $end = $total;
else $end = $page + 10;
$sdata=mysql_query("SELECT * FROM `forum_themes` ORDER BY `updater` DESC LIMIT $page,10");
if($total==0){
echo'<div class="p">
Error<br>
</div>';}else{
while($ofile=mysql_fetch_array($sdata)){
echo'<div class="p">';
$odfile=mysql_query("SELECT * FROM `forum_messages` WHERE `id_them`='".$ofile['id_them']."' ORDER BY `timer` DESC LIMIT 1");
$ftk=mysql_fetch_assoc(mysql_query("SELECT `fname` FROM `forum_kategory` WHERE `id_forum`='".$ofile['id_kat']."' LIMIT 1"));
echo'<a href="/forum/view/'.$ofile['id_kat'].'/">'.$ftk['fname'].'</a>><a href="/forum/theme/'.$ofile['id_kat'].'/'.$ofile['id_them'].'/">'.$ofile['ftname'].'</a> (';
if(mysql_num_rows($odfile)==0){echo nik_tri($ofile['id_user']).' ';
}else{
$otfile=mysql_fetch_assoc($odfile);
echo nik_tri($otfile['id_user']).' ';
}
$messages=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_messages` WHERE `id_them`='".$ofile['id_them']."'"),0);
if($messages>10){ $stbud=round($messages,-1); $skcf=strlen($messages);
$poslc=substr($messages,($skcf-1),$skcf);
if($poslc>=5 or $poslc=='0'){$stbud=$stbud-10;}
echo'<a href="/forum/theme/'.$ofile['id_kat'].'/'.$ofile['id_them'].'/page='.$stbud.'"><b>»</b></a>';
} echo', ';
if(mysql_num_rows($odfile)==0){echo date_fixed($ofile['timer']).')</div>';
}else{
$otfile=mysql_fetch_assoc($odfile);
echo date_fixed($otfile['timer']).')</div>';
}
}}
strpage($page, 10, $total, 'new_messages.php');
require"../system/foot.php";
?>