a place in the index.php
#================================================================================#
# LATEST POPULAR TORRENTS #
#================================================================================#
begin_frame("Top 20");
if ($site_config["MEMBERSONLY"] && !$CURUSER) {
echo "<br /><br /><center><b>".T_("BROWSE_MEMBERS_ONLY")."</b></center><br /><br />";
} else {
//Hide porn
$wherea=array();
$wherea[] = "banned = 'no'";
$wherea[] = "visible = 'yes'";
//Here, we define the blocked categories
if ($CURUSER["view_xxx"]!="yes") {
$wherea[] = "torrents.category != '61'";
}
$where = implode(" AND ", $wherea);
$query = "SELECT torrents.id, torrents.anon, torrents.announce, torrents.category, torrents.leechers, torrents.nfo, torrents.seeders, torrents.name, torrents.times_completed, torrents.size, torrents.added, torrents.comments, torrents.numfiles, torrents.filename, torrents.owner, torrents.external, torrents.freeleech, categories.name AS cat_name, categories.image AS cat_pic, categories.parent_cat AS cat_parent, users.username, users.privacy, IF(torrents.numratings < 2, NULL, ROUND(torrents.ratingsum / torrents.numratings, 1)) AS rating FROM torrents LEFT JOIN categories ON category = categories.id LEFT JOIN users ON torrents.owner = users.id WHERE $where ORDER BY torrents.seeders DESC LIMIT 20";
$res = SQL_Query_exec($query);
if (mysql_num_rows($res)) {
torrenttable($res);
}else {
print("<div class='f-border'>");
print("<div class='f-cat' width='100%'>".T_("NOTHING_FOUND")."</div>");
print("<div>");
print T_("NO_UPLOADS");
print("</div>");
print("</div>");
}
if ($CURUSER)
SQL_Query_exec("UPDATE users SET last_browse=".gmtime()." WHERE id=$CURUSER[id]");
}
end_frame();
#================================================================================#
# LAST END POPULAR TORRENTS #
#================================================================================#