Thread: req top 10
View Single Post
  #2  
Old 31st May 2015, 01:13
TheLastKinQ TheLastKinQ is offline
Member
 
Join Date: Jun 2008
Posts: 2
Default
Add to index.php


Code:
//== Top ten torrents
       print("<script type='text/javascript' src='{$TBDEV['baseurl']}/scripts/wz_tooltip.js'></script>");
print("<table width=100% cellspacing='0' cellpadding='5'>
       <tr><td align='center'>");
       
$res = mysql_query("SELECT t.id, t.name, t.added,  t.category, t.seeders, t.times_completed, t.leechers, categories.name AS cat_name, categories.image AS cat_pic "."FROM torrents AS t "."LEFT JOIN categories ON categories.id = t.category "."WHERE t.visible='yes' "."ORDER BY t.times_completed DESC LIMIT 5 ") or sqlerr(__FILE__, __LINE__);
if (mysql_num_rows($res) > 0) {
       Print("<table width=100% align='center' class='tableinborder' border='2' cellspacing='0' cellpadding='5'>\n");
       Print("<tr><td class=tdh2>Type</td><td class='tdh2'><b>Name [Top 10 torrents]</b></td>
<td class=tdh2 align=center>Added</td>
<td class=tdh2 align=center>Snatched</td>
<td align=center class='tdh2' width='1%'>Seeders</td>
<td align=center class='tdh2' width='1%'>Leechers</td></tr>\n");
       while ($arr = mysql_fetch_assoc($res)) {
       $torrname = htmlspecialchars($arr['name']);
       if (strlen($torrname) > 150)
       $torrname = substr($torrname, 0,150) . "...";


$catname = htmlspecialchars($arr['cat_name']);
$catpic = htmlspecialchars($arr['cat_pic']);


       Print("<tr><td class=tablea width=42><a href='/browse.php?cat={$arr['category']}'><img border=\"0\"  src='pic/{$catpic}' width=42 height=42 alt=\"{$row['cat_name']}\" /></a></td>
<td class='tablea' align=left><a href=\"{$TBDEV['baseurl']}/details.php?id=".$arr['id']."&amp;hit=1\" onmouseover=\"Tip('$poster');\" onmouseout=\"UnTip();\">".$torrname."</a></td>
<td align=center>".$arr["added"]."</td><td align=center>".$arr['times_completed']."</td><td align=center>".$arr['seeders']."</td><td align=center>".number_format($arr['leechers'])."</td></tr>\n"); 
       }
       Print("</table>\n");
       } else
       Print("no torrents here :(");
       Print("</td>");
       print("</tr></table></div>");
       //== End topten torrents
Reply With Quote
The Following User Says Thank You to TheLastKinQ For This Useful Post:
LACA34 (25th June 2015)