Код: Выделить всё
$sql = "SELECT t.topic_id, t.topic_title, t.topic_last_post_id, t.topic_replies, p.post_time
FROM " . TOPICS_TABLE . " AS t, " . POSTS_TABLE . " AS p
WHERE t.forum_id NOT IN (" . $unauthed . ")
AND p.post_time < 365*86400
AND p.topic_id = t.topic_id
AND p.post_id = t.topic_last_post_id
AND t.topic_moved_id = 0
ORDER BY RAND()
LIMIT " . $recent_nm;