Создаем block-randtorr.php в blocks и запускаем в админке
Код:
<?php if (!defined('BLOCK_FILE')) { header("Location: ../index.php"); exit; } global $tracker_lang; $num = 0; $content = "<table width=\"100%\" style=\"border: 0px;\" cellspacing=\"0\" cellpadding=\"5\" valign=\"top\" align=\"center\"><tr>"; $res = sql_query("SELECT id, name, seeders, leechers, size, numfiles AS files, image1 FROM torrents WHERE seeders > 0 ORDER BY rand() DESC LIMIT 4") or sqlerr(__FILE__, __LINE__); if (mysql_num_rows($res) > 0) { while ($arr = mysql_fetch_assoc($res)) { $torrname = $arr['name']; if (strlen($torrname) > 55) $torrname = substr($torrname, 0, 55) . "..."; $content .= "<td style=\"border: 0px;\"><b><center><a href=\"details.php?id=".$arr['id']."&hit=1\" alt=\"".$arr['name']."\" title=\"".$arr['name']."\">".$torrname."</a><br / >(".mksize($arr["size"])."".($arr["files"]>1?" @ ".$arr["files"]." files":"").")<br /></b><font color=\"#0099FF\"><b>".($arr["files"]>1?"<img src=\"./pic/multi.png\">":"<img src=\"./pic/single.png\">")." Раздают: ".number_format($arr['seeders'])." Качают: ".number_format($arr['leechers'])."</b></font></br /><img src=\"./torrents/images/".$arr['image1']."\" width=\"100\"></td>\n"; } } else $content .= "<td><b> ".$tracker_lang['no_torrents']." </b></td>\n"; $content .= "</tr></table>"; ?>