<?php
echo '<div class="phdr"><b>Chủ Đề Mới </b>| <a href="forum/"></b>Diễn đàn</b></a></div>';
$req = mysql_query("SELECT * FROM `forum` WHERE `type` = 't' and kedit='0' AND `close`!='1' ORDER BY `time` DESC LIMIT 10");
while ($arr = mysql_fetch_array($req)) {
/////////Thumb
$img = get_thumb($arr[id]);
echo '<img src="'.$img.'" alt="'.$img.'" width="20%" height="20%"/>';
////////End Thumb
$q3 = mysql_query("select `id`, `refid`, `text` from `forum` where type='r' and id='" .$arr['refid'] . "'");
$razd = mysql_fetch_array($q3);
$q4 = mysql_query("select `id`, `refid`, `text` from `forum` where type='f' and id='" .$razd['refid'] . "'");
$frm = mysql_fetch_array($q4);
$nikuser = mysql_query("SELECT `from`,`id`, `time` FROM `forum` WHERE `type` = 'm' AND `close` != '1' AND `refid` = '" . $arr['id'] . "'ORDER BY time DESC");
$colmes1 = mysql_num_rows($nikuser);
$cpg = ceil($colmes1 / $kmess);
$nam = mysql_fetch_array($nikuser);
echo is_integer($i / 2) ? '<div class="list1">' : '<div class="list2">';
echo '<img src="images/' . ($arr['edit'] == 1 ? 'tz' : 'np') . '.gif" alt=""/>';
if ($arr['realid'] == 1)
echo ' <img src="images/rate.gif" alt=""/>';
echo ' <a href="/forum/index.php?id=' . $arr['id'] . ($cpg > 1&&$_SESSION['uppost'] ? '&clip&page=' . $cpg : '') .'">'.bbcode::tags($arr['text']). '</a> [' . $colmes1 . ']';
if ($cpg > 1)
echo ' <a href="/forum/index.php?id=' . $arr['id'] . ($_SESSION['uppost'] ? '' :'&clip&page=' . $cpg) . '#' . $nam['id'].'"></a>';
if (!empty ($nam['from'])) {
echo ' ' . $nam['from'];
}
echo '</div>';
$i++;
}
?>