Login
Username: Password:
Remember me

[Sign Up] / [Recover Password]

Theme / Language

Popular
New Torrents
new name
Size: 18.40 MB
Most active
new name
S: 74 L: 3
New Posters
Top Ten Users/Torrents/Countries
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / v2.08 / v2.08 Mods Completed

Unknown User
2013-03-22 09:20:35
This is another mod from tbdev that I adapted to work for TT 2.08

Create a new file called topten and upload it in your root:


<?php

require "backend/functions.php";
dbconn(false);
loggedinonly();

if (get_user_class() < 2)
   show_error_msg("Acces denied", "You must be at least Power User!", 1);

function usertable($res, $frame_caption) {
global $CURUSER;
   
begin_frame($frame_caption, true);
?>

<table class=table_table width=100% align=center border=0 cellpadding=4>
   <tr style="font:bold">

       <td class=table_head align=center width=10%>Rank</td>
       <td class=table_head align=left width=20%>User</td>
       <td class=table_head align=left width=10%>Uploaded</td>
       <td class=table_head align=left width=10%>UL speed</td>
       <td class=table_head align=left width=10%>Downloaded</td>
       <td class=table_head align=left width=10%>DL speed</td>
       <td class=table_head align=center width=10%>Ratio</td>
       <td class=table_head align=center width=20%>Joined</td>
   </tr>

<?php
   $num = 0;
   
while ($a = mysql_fetch_assoc($res)) {
 ++$num;
$highlight = $CURUSER["id"] == $a["userid"] ? " bgcolor=#1B2B1F" : "";

if ($a["downloaded"]) {
$ratio = $a["uploaded"] / $a["downloaded"];
$color = get_ratio_color($ratio);
$ratio = number_format($ratio, 2);
   
if ($color)
$ratio = "<font color=$color>$ratio</font>";
} else
$ratio = "Inf.";
print("<tr$highlight>
       
<td class=table_col1 align=center>$num</td>
<td class=table_col2 align=left$highlight><a href=account-details.php?id=" .$a["userid"] . "><b>" .    $a["username"] . "</b>" ."</td>
       <td class=table_col1 align=left$highlight><font color=limegreen>" . mksize($a["uploaded"]) . "</font></td>
       <td class=table_col2 align=left$highlight><font color=limegreen>" . mksize($a["upspeed"]) . "/s" ."</font></td>
       <td class=table_col1 align=left$highlight><font color=#FF2400>" . mksize($a["downloaded"]) . "</font></td>
       <td class=table_col2 align=left$highlight><font color=#FF2400>" . mksize($a["downspeed"]) . "/s" . "</font></td>
       <td class=table_col1 align=center$highlight>" . $ratio ."</td>
       <td class=table_col2 align=center>" . gmdate("d-M-Y",strtotime($a["added"])) . " (" .get_elapsed_time(sql_timestamp_to_unix_timestamp($a["added"])) . " ago)</td>
     </tr>");
}
print("</table>");
   end_frame();
 }

function _torrenttable($res, $frame_caption) {

begin_frame($frame_caption, true);

?>

<table class=table_table width=100% align=center border=0 cellpadding=4>
   <tr style="font:bold">
       <td class=table_head align=center>Rank</td>
       <td class=table_head align=left>Name</td>
       <td class=table_head align=center><img src="images/ready.png" border=0 title=Completed></td>
       <td class=table_head align=right>Traffic</td>
       <td class=table_head align=right><img src="images/seed.gif" border=0 title=Seeders></td></td>
       <td class=table_head align=right><img src="images/leech.gif" border=0 title=Leechers></td></td>
       <td class=table_head align=right>Total</td>
       <td class=table_head align=right>Ratio</td>
</tr>

<?php

   $num = 0;

while ($a = mysql_fetch_assoc($res)) {
 ++$num;

if ($a["leechers"]) {
$r = $a["seeders"] / $a["leechers"];
   $ratio = "<font color=" . get_ratio_color($r) . ">" . number_format($r, 2) . "</font>";
} else
$ratio = "Inf.";
   print("<tr>
       <td align=center class=table_col1>$num</td>
       <td align=left class=table_col2><a href=torrents-details.php?id=" . $a["id"] . "&hit=1><b>" . $a["name"] . "</b></a></td>
       <td align=center class=table_col1><font color=#0080FF><b>" . number_format($a["times_completed"]) . "</b></font></td>
       <td align=right class=table_col2>" . mksize($a["data"]) . "</td>
       <td align=right class=table_col1><font color=limegreen><b>" . number_format($a["seeders"]) . "</b></font></td>
       <td align=right class=table_col2><font color=red><b>" . number_format($a["leechers"]) . "</b></font></td>
       <td align=right class=table_col1>" . ($a["leechers"] + $a["seeders"]) . "</td>
       <td align=right class=table_col2>$ratio</td>
   </tr>\n");
}
   print("</table>");

end_frame();
}
 
function countriestable($res, $frame_caption, $what) {
global $CURUSER;

begin_frame($frame_caption, true);

?>

<table class=table_table width=50% align=center border=0 cellpadding=4>
   <tr style="font:bold">
       <td class=table_head align=center>Rank</td>
       <td class=table_head align=center>Country&nbsp;Flag</td>
       <td class=table_head align=left>Country&nbsp;Name</td>
       <td class=table_head align=right><?=$what?></td>
   </tr>

<?php

   $num = 0;
   
while ($a = mysql_fetch_assoc($res)) {
   ++$num;

if ($what == "Users")
  $value = number_format($a["num"]);
elseif ($what == "Uploaded")
       $value = mksize($a["ul"]);
elseif ($what == "Average")
   $value = mksize($a["ul_avg"]);
elseif ($what == "Ratio")
       $value = number_format($a["r"],2);

if ($a[flagpic]) {
       $flag = "<img align=center src=images/countries/$a[flagpic]>";
   } else {
   $flag = "<img align=center src=images/countries/unknown.gif>";
}

if ($a[name]) {
  $name = "<b>$a[name]</b>";
} else {
  $name = "<b>Land of Homeless!</b>";
}
   print("<tr>
       <td align=center class=table_col1>$num</td>
       <td align=center class=table_col2>" . "$flag</td>
       <td class=table_col1>$name</td>" . "
       <td align=right class=table_col2>$value</td>
   </tr>\n");
}
   print("</table>");

   end_frame();
 }

stdhead("Top 10");

 begin_frame("..:: Top Ten ::..");

   $type = isset($_GET["type"]) ? 0 + $_GET["type"] : 0;

if (!in_array($type,array(1,2,3)))
   $type = 1;
   $limit = isset($_GET["lim"]) ? 0 + $_GET["lim"] : false;
   $subtype = isset($_GET["subtype"]) ? $_GET["subtype"] : false;

   print("<div style='font: bold 12px Verdana; margin-top:10px; margin-bottom:15px' align=center>" .

   ($type == 1 && !$limit ? "Users" : "<a href=topten.php?type=1>Users</a>") .    " | " .
   ($type == 2 && !$limit ? "Torrents" : "<a href=topten.php?type=2>Torrents</a>") . " | " .
   ($type == 3 && !$limit ? "Countries" : "<a href=topten.php?type=3>Countries</a>") . "
   </div>\n");

   $pu = get_user_class($CURUSER) >= 3;

 if (!$pu)
 $limit = 10;

 if ($type == 1) {

   $mainquery = "SELECT id as userid, username, added, uploaded, downloaded, uploaded / (UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(added)) AS upspeed, downloaded / (UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(added)) AS downspeed FROM users WHERE enabled = 'yes'";

if (!$limit || $limit > 250)
   $limit = 10;

if ($limit == 10 || $subtype == "ul") {
$order = "uploaded DESC";
$r = SQL_Query_exec($mainquery . " ORDER BY $order " . " LIMIT $limit");
 usertable($r, "Top $limit Uploaders" . ($limit == 10 && $pu ? " <font class=small> -
[<a href=topten.php?type=1&amp;lim=100&amp;subtype=ul>Top 100</a>] - [<a href=topten.php?type=1&amp;lim=250&amp;subtype=ul>Top 250</a>]</font>" : ""));
}

if ($limit == 10 || $subtype == "dl") {
$order = "downloaded DESC";
$r = SQL_Query_exec($mainquery . " ORDER BY $order " . " LIMIT $limit");
 usertable($r, "Top $limit Downloaders" . ($limit == 10 && $pu ? " <font class=small> -
[<a href=topten.php?type=1&amp;lim=100&amp;subtype=dl>Top 100</a>] - [<a href=topten.php?type=1&amp;lim=250&amp;subtype=dl>Top 250</a>]</font>" : ""));
}
 
if ($limit == 10 || $subtype == "uls") {
$order = "upspeed DESC";
$r = SQL_Query_exec($mainquery . " ORDER BY $order " . " LIMIT $limit");
 usertable($r, "Top $limit Fastest Uploaders <font class=small>(average, includes inactive time)</font>" .
     ($limit == 10 && $pu ? " <font class=small> - [<a href=topten.php?type=1&amp;lim=100&amp;subtype=uls>Top 100</a>] -
[<a href=topten.php?type=1&amp;lim=250&amp;subtype=uls>Top 250</a>]</font>" : ""));
}

if ($limit == 10 || $subtype == "dls") {
$order = "downspeed DESC";
$r = SQL_Query_exec($mainquery . "  ORDER BY $order " . " LIMIT $limit");
 usertable($r, "Top $limit Fastest Downloaders <font class=small>(average, includes inactive time)</font>" . ($limit == 10 && $pu ? " <font class=small> - [<a href=topten.php?type=1&amp;lim=100&amp;subtype=dls>Top 100</a>] - [<a href=topten.php?type=1&amp;lim=250&amp;subtype=dls>Top 250</a>]</font>" : ""));
}
   
if ($limit == 10 || $subtype == "bsh") {
$order = "uploaded / downloaded DESC";
$extrawhere = " AND downloaded > 1073741824";
$r = SQL_Query_exec($mainquery . $extrawhere . " ORDER BY $order " . " LIMIT $limit");
 usertable($r, "Top $limit Best Sharers <font class=small>(with minimum 1 GB downloaded)</font>" . ($limit == 10 && $pu ? " <font class=small> - [<a href=topten.php?type=1&amp;lim=100&amp;subtype=bsh>Top 100</a>] - [<a href=topten.php?type=1&amp;lim=250&amp;subtype=bsh>Top 250</a>]</font>" : ""));
}

if ($limit == 10 || $subtype == "wsh") {
$order = "uploaded / downloaded ASC, downloaded DESC";
$extrawhere = " AND downloaded > 1073741824";
$r = SQL_Query_exec($mainquery . $extrawhere . " ORDER BY $order " . " LIMIT $limit");

 usertable($r, "Top $limit Worst Sharers <font class=small>(with minimum 1 GB downloaded)</font>" . ($limit == 10 && $pu ? " <font class=small> - [<a href=topten.php?type=1&amp;lim=100&amp;subtype=wsh>Top 100</a>] - [<a href=topten.php?type=1&amp;lim=250&amp;subtype=wsh>Top 250</a>]</font>" : ""));
}
}
elseif ($type == 2)
{
 
if (!$limit || $limit > 50)
$limit = 10;

if ($limit == 10 || $subtype == "act") {

   $r = SQL_Query_exec("SELECT t.*, (t.size * t.times_completed + SUM(p.downloaded)) AS data FROM torrents AS t LEFT JOIN peers AS p ON t.id = p.torrent WHERE p.seeder = 'no' GROUP BY t.id ORDER BY seeders + leechers DESC, seeders DESC, added ASC LIMIT $limit");

 _torrenttable($r, "Top $limit Most Active Torrents" . ($limit == 10 && $pu ? " <font class=small> - [<a href=topten.php?type=2&amp;lim=25&amp;subtype=act>Top 25</a>] - [<a href=topten.php?type=2&amp;lim=50&amp;subtype=act>Top 50</a>]</font>" : ""));
}

if ($limit == 10 || $subtype == "sna") {

$r = SQL_Query_exec("SELECT t.*, (t.size * t.times_completed + SUM(p.downloaded)) AS data FROM torrents AS t LEFT JOIN peers AS p ON t.id = p.torrent WHERE p.seeder = 'no' GROUP BY t.id ORDER BY times_completed DESC LIMIT $limit");
 _torrenttable($r, "Top $limit Most Snatched Torrents" . ($limit == 10 && $pu ? " <font class=small> - [<a href=topten.php?type=2&amp;lim=25&amp;subtype=sna>Top 25</a>] - [<a href=topten.php?type=2&amp;lim=50&amp;subtype=sna>Top 50</a>]</font>" : ""));
}

if ($limit == 10 || $subtype == "mdt") {
   $r = SQL_Query_exec("SELECT t.*, (t.size * t.times_completed + SUM(p.downloaded)) AS data FROM torrents AS t LEFT JOIN peers AS p ON t.id = p.torrent WHERE p.seeder = 'no' AND leechers >= 5 AND times_completed > 0 GROUP BY t.id ORDER BY data DESC, added ASC LIMIT $limit");

       _torrenttable($r, "Top $limit Most Data Transferred Torrents" . ($limit == 10 && $pu ? " <font class=small> - [<a href=topten.php?type=2&amp;lim=25&amp;subtype=mdt>Top 25</a>] - [<a href=topten.php?type=2&amp;lim=50&amp;subtype=mdt>Top 50</a>]</font>" : ""));
}
   
if ($limit == 10 || $subtype == "bse") {
   $r = SQL_Query_exec("SELECT t.*, (t.size * t.times_completed + SUM(p.downloaded)) AS data FROM torrents AS t LEFT JOIN peers AS p ON t.id = p.torrent WHERE p.seeder = 'no' AND seeders >= 5 GROUP BY t.id ORDER BY seeders / leechers DESC, seeders DESC, added ASC LIMIT $limit");
 _torrenttable($r, "Top $limit Best Seeded Torrents <font class=small>(with minimum 5 seeders)</font>" . ($limit == 10 && $pu ? " <font class=small> - [<a href=topten.php?type=2&amp;lim=25&amp;subtype=bse>Top 25</a>] - [<a href=topten.php?type=2&amp;lim=50&amp;subtype=bse>Top 50</a>]</font>" : ""));
}

if ($limit == 10 || $subtype == "wse") {
   $r = SQL_Query_exec("SELECT t.*, (t.size * t.times_completed + SUM(p.downloaded)) AS data FROM torrents AS t LEFT JOIN peers AS p ON t.id = p.torrent WHERE p.seeder = 'no' AND leechers >= 5 AND times_completed > 0 GROUP BY t.id ORDER BY seeders / leechers ASC, leechers DESC LIMIT $limit");
       _torrenttable($r, "Top $limit Worst Seeded Torrents <font class=small>(with minimum 5 leechers, excluding unsnatched torrents)</font>" . ($limit == 10 && $pu ? " <font class=small> - [<a href=topten.php?type=2&amp;lim=25&amp;subtype=wse>Top 25</a>] - [<a href=topten.php?type=2&amp;lim=50&amp;subtype=wse>Top 50</a>]</font>" : ""));
}
}
elseif ($type == 3)
{

if (!$limit || $limit > 25)
$limit = 10;

if ($limit == 10 || $subtype == "us") {
   $r = SQL_Query_exec("SELECT name, flagpic, COUNT(users.country) as num FROM countries LEFT JOIN users ON users.country = countries.id GROUP BY name ORDER BY num DESC LIMIT $limit");
       countriestable($r, "Top $limit Countries<font class=small> (users)</font>" . ($limit == 10 && $pu ? " <font class=small> - [<a href=topten.php?type=3&amp;lim=25&amp;subtype=us>Top 25</a>]</font>" : ""),"Users");
}

if ($limit == 10 || $subtype == "ul") {
   $r = SQL_Query_exec("SELECT c.name, c.flagpic, sum(u.uploaded) AS ul FROM users AS u LEFT JOIN countries AS c ON u.country = c.id WHERE u.enabled = 'yes' GROUP BY c.name ORDER BY ul DESC LIMIT $limit");

 countriestable($r, "Top $limit Countries<font class=small> (total uploaded)</font>" . ($limit == 10 && $pu ? " <font class=small> - [<a href=topten.php?type=3&amp;lim=25&amp;subtype=ul>Top 25</a>]</font>" : ""),"Uploaded");
}

if ($limit == 10 || $subtype == "avg") {
   $r = SQL_Query_exec("SELECT c.name, c.flagpic, sum(u.uploaded)/count(u.id) AS ul_avg FROM users AS u LEFT JOIN countries AS c ON u.country = c.id WHERE u.enabled = 'yes' GROUP BY c.name HAVING sum(u.uploaded) > 1099511627776 AND count(u.id) >= 100 ORDER BY ul_avg DESC LIMIT $limit");

 countriestable($r, "Top $limit Countries<font class=small> (average total uploaded per user, with minimum 1TB uploaded and 100 users)</font>" . ($limit == 10 && $pu ? " <font class=small> -
[<a href=topten.php?type=3&amp;lim=25&amp;subtype=avg>Top 25</a>]</font>" : ""),"Average");
}

if ($limit == 10 || $subtype == "r") {
   $r = SQL_Query_exec("SELECT c.name, c.flagpic, sum(u.uploaded)/sum(u.downloaded) AS r FROM users AS u LEFT JOIN countries AS c ON u.country = c.id WHERE u.enabled = 'yes' GROUP BY c.name HAVING sum(u.uploaded) > 1099511627776 AND sum(u.downloaded) > 1099511627776 AND count(u.id) >= 100 ORDER BY r DESC LIMIT $limit");

 countriestable($r, "Top $limit Countries<font class=small> (ratio, with minimum 1TB uploaded, 1TB downloaded and 100 users)</font>" . ($limit == 10 && $pu ? " <font class=small> -
[<a href=topten.php?type=3&amp;lim=25&amp;subtype=r>Top 25</a>]</font>" : ""),"Ratio");
}
}

end_frame();
stdfoot();
?>


Into 'Top 10 Fastest Uploaders' list you can easily find the users with abnormal amount of upload in a very short time.

[url="http://devscorner.xyz/applications/core/interface/file/attachment.php?id=6658"]images.zip[/url]
images.zip
Download
Unknown User
2013-03-22 09:48:53
thanks

the only problem with a dark theme is below the ratio the characters are black color... i dont see where in php change this color

Unknown User
2013-03-22 11:43:10
It seems that you don't have this function in functions.php:



function get_ratio_color($ratio) {

   if ($ratio < 0.1) return "#AD1400";

   if ($ratio < 0.2) return "#CB1800";

   if ($ratio < 0.3) return "#EC1C00";

   if ($ratio < 0.4) return "#D26200";

   if ($ratio < 0.5) return "#9D9B00";

   if ($ratio < 0.6) return "#C1B500";

   if ($ratio < 0.7) return "#A1BE00";

   if ($ratio < 0.8) return "#94C500";

   if ($ratio < 0.9) return "#7ECC00";

   if ($ratio < 1) return "#6FDD00";

   return "#2DDF00";

}



So copy this code there, below the last function.
Unknown User
2013-03-22 13:04:23
i have this but different colors, anyway i change with your colors and its ok now.

Thanks again
Unknown User
2013-03-22 17:00:43
Thanks :P
Unknown User
2013-03-22 21:40:33
Tanks Man Top Of Top :D
2013-03-22 23:56:54
Woww! Big thanks! lol  :D
Unknown User
2013-05-05 11:47:28
no top ten torrents showing lol with colur class adder lol

 <td class=table_col2 align=left$highlight><a href=account-details.php?id=" .$a["userid"] . "><b>".class_user($a[username])."</b>" ."</td>

bug top ten torrent nothing showing
        <td align=left class=table_col2><a href=torrents-details.php?id=" . $a["id"] . "&hit=1><b>" . $a["name"] . "</b></a></td>



bad remake of tbv mod
Unknown User
2013-05-12 00:56:00
This now worked in my tracker.   :unsure:
Unknown User
2013-05-12 02:31:33
perfect
Unknown User
2013-05-12 11:44:58
Thank you
Unknown User
2013-05-26 16:52:53
its blank page , Why ?
2013-05-26 19:12:13
"DONX, post: 90585":

its blank page , Why ?
seeks

<?

replaced

<?php
Unknown User
2013-05-26 23:04:16
Its probably an blank page cause you have short-tag turned off, its why the person said to change <? to <?php
Unknown User
2013-06-20 17:31:41
short-tag turned ON , Now its Works Perfect , Thanks VERY Much ArcticWolf

and BigMax1
Users online

No users online

Search



Statistics

    Torrents

  • Tracking: 3
  • Todays torrents: 0
  • Seeders: 0
  • Leechers: 0
  • Peers: 0
  • Downloaded: 89.96 GB
  • Uploaded: 9.86 GB

  • Members

  • We have: 838
  • New today: 0
  • Guest today: 9

  • Online

  • Total online: 9
  • Members: 0
  • Guests online: 9
  • Comments: 3
  • Messages: 1,728