Файл: pages/forum/new_t.php
Строк: 48
<?php
include '../../system/mysql.php';
include '../../system/sys_func.php';
$title = 'Форум/Новые темы';
include '../../system/head.php';
echo '<div class="title"><a href="index.php">Форум</a> / Новые темы</div>';
$c_p = mysql_result(mysql_query("SELECT COUNT(*) FROM `f_theme` WHERE `time` > '". (time()-60*60*24) ."'"),0);
if (isset($user)) $p_page = $user['p_page'];
else $p_page = '10';
$k_page = k_page($c_p, $p_page);
$page = page($k_page);
$start = $p_page*$page-$p_page;
if ($c_p == 0) {
echo '<div class="post">
Нет новых тем за последние сутки!
</div>';
}
$q = mysql_query("SELECT * FROM `f_theme` WHERE `time` > '". (time()-60*60*24) ."' ORDER BY `last_post` DESC LIMIT $start, ". $p_page);
while ($them = mysql_fetch_assoc($q)) {
$forum = mysql_fetch_assoc(mysql_query("SELECT * FROM `forum` WHERE `id` = '". $them['forum_id'] ."' LIMIT 1"));
$cat = mysql_fetch_assoc(mysql_query("SELECT * FROM `f_category` WHERE `id` = '". $them['cat_id'] ."' LIMIT 1"));
$ank = mysql_fetch_assoc(mysql_query("SELECT * FROM `users` WHERE `id` = '". $them['id_user'] ."' LIMIT 1"));
echo '<div class="post">
<span class="c_date">'. ptime($them['time']) .'</span>';
if ($them['fix'] == 1) {
echo '<img src="/design/imgs/stick.gif" alt="top" /> ';
}
echo '<a href="topic.php?id='. $them['id'] .'&page=end">' . $them['name'] . '</a>
('. mysql_result(mysql_query("SELECT COUNT(*) FROM `f_post` WHERE `forum_id` = '$forum[id]' AND `cat_id` = '$cat[id]' AND `them_id` = '$them[id]'"),0) .')';
if ($them['close'] == 1) {
echo ' <img src="/design/imgs/topic_locked.gif" alt="top" />';
}
echo '<br>';
echo online($ank['id']);
echo ' <a href="/pages/users/user.php?name='. $ank['login'] .'">'. $ank['login'] .'</a> / ';
$post2 = mysql_fetch_assoc(mysql_query("SELECT * FROM `f_post` WHERE `them_id` = '$them[id]' ORDER BY `time` DESC LIMIT 1"));
$ank2 = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '$post2[id_user]'"));
if (isset($post2['id_user'])) {
echo online($ank2['id']);
if ($ank['login'] == $ank2['login']) {
echo ' <span style="color:#666">'. $ank2['login'] .' ('. ptime($them['time']) .')</span>';
} else {
echo ' <a href="/pages/users/user.php?name='. $ank2['login'] .'">'. $ank2['login'] .'</a> <span style="color:#666">('. ptime($post2['time']) .')</span>';
}
} else {
echo online($ank['id']);
echo ' <span style="color:#666">'. $ank['login'] .' ('. ptime($them['time']) .')</span>';
}
echo "</div>";
}
if ($k_page > 1) str('?', $k_page, $page);
include '../../system/foot.php';
?>