예제 #1
0
파일: topten.php 프로젝트: thefkboss/U-232
    }
    if ($limit == 10 || $subtype == "sna") {
        $r = sql_query("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}") or sqlerr();
        $HTMLOUT .= _torrenttable($r, sprintf($lang['torrent_mostsna'], $limit) . ($limit == 10 && $pu ? " <font class='small'> - [<a href='topten.php?type=2&amp;lim=25&amp;subtype=sna'>{$lang['common_top25']}</a>] - [<a href='topten.php?type=2&amp;lim=50&amp;subtype=sna'>{$lang['common_top50']}</a>]</font>" : ""));
    }
    if ($limit == 10 || $subtype == "mdt") {
        $r = sql_query("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}") or sqlerr();
        $HTMLOUT .= _torrenttable($r, sprintf($lang['torrent_datatrans'], $limit) . ($limit == 10 && $pu ? " <font class='small'> - [<a href='topten.php?type=2&amp;lim=25&amp;subtype=mdt'>{$lang['common_top25']}</a>] - [<a href='topten.php?type=2&amp;lim=50&amp;subtype=mdt'>{$lang['common_top50']}</a>]</font>" : ""));
    }
    if ($limit == 10 || $subtype == "bse") {
        $r = sql_query("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}") or sqlerr();
        $HTMLOUT .= _torrenttable($r, sprintf($lang['torrent_bestseed'], $limit) . ($limit == 10 && $pu ? " <font class='small'> - [<a href='topten.php?type=2&amp;lim=25&amp;subtype=bse'>{$lang['common_top25']}</a>] - [<a href='topten.php?type=2&amp;lim=50&amp;subtype=bse'>{$lang['common_top50']}</a>]</font>" : ""));
    }
    if ($limit == 10 || $subtype == "wse") {
        $r = sql_query("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}") or sqlerr();
        $HTMLOUT .= _torrenttable($r, sprintf($lang['torrent_worstseed'], $limit) . ($limit == 10 && $pu ? " <font class='small'> - [<a href='topten.php?type=2&amp;lim=25&amp;subtype=wse'>{$lang['common_top25']}</a>] - [<a href='topten.php?type=2&amp;lim=50&amp;subtype=wse'>{$lang['common_top50']}</a>]</font>" : ""));
    }
} elseif ($type == 3) {
    if (!$limit || $limit > 25) {
        $limit = 10;
    }
    if ($limit == 10 || $subtype == "us") {
        $r = sql_query("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}") or sqlerr();
        $HTMLOUT .= countriestable($r, sprintf($lang['country_mostact'], $limit) . ($limit == 10 && $pu ? " <font class='small'> - [<a href='topten.php?type=3&amp;lim=25&amp;subtype=us'>{$lang['common_top25']}</a>]</font>" : ""), $lang['common_users']);
    }
    if ($limit == 10 || $subtype == "ul") {
        $r = sql_query("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}") or sqlerr();
        $HTMLOUT .= countriestable($r, sprintf($lang['country_totalul'], $limit) . ($limit == 10 && $pu ? " <font class='small'> - [<a href='topten.php?type=3&amp;lim=25&amp;subtype=ul'>{$lang['common_top25']}</a>]</font>" : ""), $lang['common_ul']);
    }
    if ($limit == 10 || $subtype == "avg") {
        $r = sql_query("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}") or sqlerr();
예제 #2
0
        echo "<br /><br />";
    }
}
if (user::$current["view_torrents"] == "yes") {
    $r = $db->query("SELECT summary.info_hash AS hash, summary.seeds AS seeds, summary.leechers AS leechers, summary.finished, summary.dlbytes AS dwned, namemap.filename AS name, namemap.url AS url, namemap.info, summary.speed AS speed, namemap.uploader FROM summary LEFT JOIN namemap ON summary.info_hash = namemap.info_hash ORDER BY seeds + leechers DESC LIMIT 10") or sqlerr();
    if ($r->num_rows > 0) {
        _torrenttable($r, TOP_10_ACTIVE . " </font>");
        echo "<br /><br />";
    }
    $r = $db->query("SELECT summary.info_hash AS hash, summary.seeds AS seeds, summary.leechers AS leechers, summary.finished, summary.dlbytes AS dwned, namemap.filename AS name, namemap.url AS url, namemap.info, summary.speed AS speed, namemap.uploader FROM summary LEFT JOIN namemap ON summary.info_hash = namemap.info_hash WHERE seeds >= 5 ORDER BY seeds / leechers DESC, seeds DESC LIMIT 10") or sqlerr();
    if ($r->num_rows > 0) {
        _torrenttable($r, TOP_10_BEST_SEED . "<font class='small'>(" . MINIMUM_5_SEED . ")</font>");
        echo "<br /><br />";
    }
    $r = $db->query("SELECT summary.info_hash AS hash, summary.seeds AS seeds, summary.leechers AS leechers, summary.finished, summary.dlbytes AS dwned, namemap.filename AS name, namemap.url AS url, namemap.info, summary.speed AS speed, namemap.uploader FROM summary LEFT JOIN namemap ON summary.info_hash = namemap.info_hash WHERE leechers >= 5 AND finished > 0 ORDER BY seeds / leechers ASC, leechers DESC LIMIT 10") or sqlerr();
    if ($r->num_rows > 0) {
        _torrenttable($r, TOP_10_WORST_SEED . " <font class='small'>(" . MINIMUM_5_LEECH . ")</font>");
        echo "<br /><br />";
    }
    $r = $db->query("SELECT summary.info_hash AS hash, summary.seeds AS seeds, summary.leechers AS leechers, summary.finished, summary.dlbytes AS dwned, namemap.filename AS name, namemap.url AS url, namemap.info, summary.speed AS speed, namemap.uploader FROM summary LEFT JOIN namemap ON summary.info_hash = namemap.info_hash WHERE external = 'no' ORDER BY speed DESC, seeds DESC LIMIT 10") or sqlerr();
    if ($r->num_rows > 0) {
        _torrenttable($r, TOP_10_BSPEED);
        echo "<br /><br />";
    }
    $r = $db->query("SELECT summary.info_hash AS hash, summary.seeds AS seeds, summary.leechers AS leechers, summary.finished, summary.dlbytes AS dwned, namemap.filename AS name, namemap.url AS url, namemap.info, summary.speed AS speed, namemap.uploader FROM summary LEFT  JOIN namemap ON summary.info_hash = namemap.info_hash WHERE external = 'no' ORDER BY speed ASC, seeds DESC LIMIT 10") or sqlerr();
    if ($r->num_rows > 0) {
        _torrenttable($r, TOP_10_WSPEED);
        echo "<br /><br />";
    }
}
stdfoot();
예제 #3
0
if ($CURUSER["view_torrents"] == "yes") {
    $r = get_result("SELECT f.info_hash as hash, {$tseeds} as seeds, {$tleechs} as leechers, {$tcompletes} as finished, dlbytes as dwned , filename as name, url as url, info, speed as speed, uploader FROM {$ttables} ORDER BY {$tseeds} + {$tleechs} DESC LIMIT 10", true, $CACHE_DURATION);
    if (count($r) > 0) {
        $out .= _torrenttable($r, $language["TOP_10_ACTIVE"]);
        $out .= "<br /><br />";
    }
    $r = get_result("SELECT f.info_hash as hash, {$tseeds} as seeds, {$tleechs} as leechers, {$tcompletes} as finished, dlbytes as dwned , filename as name, url as url, info, speed as speed, uploader FROM {$ttables} WHERE {$tseeds} >= 5 ORDER BY {$tseeds} / {$tleechs} DESC, seeds DESC LIMIT 10", true, $CACHE_DURATION);
    if (count($r) > 0) {
        $out .= _torrenttable($r, $language["TOP_10_BEST_SEED"] . " (" . $language["MINIMUM_5_SEED"] . ")");
        $out .= "<br /><br />";
    }
    $r = get_result("SELECT f.info_hash as hash, {$tseeds} as seeds, {$tleechs} as leechers, {$tcompletes} as finished, dlbytes as dwned , filename as name, url as url, info, speed as speed, uploader FROM {$ttables} WHERE {$tleechs} >= 5 AND {$tcompletes} > 0 ORDER BY {$tseeds} / {$tleechs} ASC, {$tleechs} DESC LIMIT 10", true, $CACHE_DURATION);
    if (count($r) > 0) {
        $out .= _torrenttable($r, $language["TOP_10_WORST_SEED"] . " (" . $language["MINIMUM_5_LEECH"] . ")");
        $out .= "<br /><br />";
    }
    if (!$XBTT_USE) {
        $r = get_result("SELECT f.info_hash as hash, {$tseeds} as seeds, {$tleechs} as leechers, {$tcompletes} as finished, dlbytes as dwned , filename as name, url as url, info, speed as speed, uploader FROM {$ttables} WHERE external='no' ORDER BY speed DESC, {$tseeds} DESC LIMIT 10", true, $CACHE_DURATION);
        if (count($r) > 0) {
            $out .= _torrenttable($r, $language["TOP_10_BSPEED"], true);
            $out .= "<br /><br />";
        }
        $r = get_result("SELECT f.info_hash as hash, {$tseeds} as seeds, {$tleechs} as leechers, {$tcompletes} as finished, dlbytes as dwned , filename as name, url as url, info, speed as speed, uploader FROM {$ttables} WHERE external='no' ORDER BY speed ASC, {$tseeds} DESC LIMIT 10", true, $CACHE_DURATION);
        if (count($r) > 0) {
            $out .= _torrenttable($r, $language["TOP_10_WSPEED"], true);
            $out .= "<br /><br />";
        }
    }
}
unset($r);
write_cached_version("extra-stats" . $CURUSER["id_level"], $out);
예제 #4
0
파일: topten.php 프로젝트: klldll/tbdev
    }
    if ($limit == 10 || $subtype == "sna") {
        $r = sql_query("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}") or sqlerr(__FILE__, __LINE__);
        _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("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}") or sqlerr(__FILE__, __LINE__);
        _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("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}") or sqlerr(__FILE__, __LINE__);
        _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("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}") or sqlerr(__FILE__, __LINE__);
        _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("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}") or sqlerr(__FILE__, __LINE__);
        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>" : ""), "Пользователи");
    }
    if ($limit == 10 || $subtype == "ul") {
        $r = sql_query("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}") or sqlerr(__FILE__, __LINE__);
        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>" : ""), "Раздача");
    }
    if ($limit == 10 || $subtype == "avg") {
        $r = sql_query("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}") or sqlerr(__FILE__, __LINE__);
예제 #5
0
   	if ($limit == 10 || $subtype == "act")
  	{
		  $r = mysql_query("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") or sqlerr();
		  _torrenttable($r, "Topp $limit virkustu Torrent" . ($limit == 10 && $pu ? " <font class=small> - [<a href=topten.php?type=2&amp;lim=25&amp;subtype=act>Topp 25</a>] - [<a href=topten.php?type=2&amp;lim=50&amp;subtype=act>Topp 50</a>]</font>" : ""));
	  }
   	if ($limit == 10 || $subtype == "sna")
   	{
	  	$r = mysql_query("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") or sqlerr();
		  _torrenttable($r, "Topp $limit sóttustu Torrent" . ($limit == 10 && $pu ? " <font class=small> - [<a href=topten.php?type=2&amp;lim=25&amp;subtype=sna>Topp 25</a>] - [<a href=topten.php?type=2&amp;lim=50&amp;subtype=sna>Topp 50</a>]</font>" : ""));
	  }
   /*	if ($limit == 10 || $subtype == "mdt")
   	{
		  $r = mysql_query("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") or sqlerr();
		  _torrenttable($r, "Topp $limit Torrent með mestu gögn millifærð" . ($limit == 10 && $pu ? " <font class=small> - [<a href=topten.php?type=2&amp;lim=25&amp;subtype=mdt>Topp 25</a>] - [<a href=topten.php?type=2&amp;lim=50&amp;subtype=mdt>Topp 50</a>]</font>" : ""));
		}*/
   	if ($limit == 10 || $subtype == "bse")
   	{
		  $r = mysql_query("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") or sqlerr();
	  	_torrenttable($r, "Topp $limit Best seeduðu Torrent <font class=small>(með minnst 5 a&eth; deila)</font>" . ($limit == 10 && $pu ? " <font class=small> - [<a href=topten.php?type=2&amp;lim=25&amp;subtype=bse>Topp 25</a>] - [<a href=topten.php?type=2&amp;lim=50&amp;subtype=bse>Topp 50</a>]</font>" : ""));
    }
   	if ($limit == 10 || $subtype == "wse")
   	{
		  $r = mysql_query("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") or sqlerr();
		  _torrenttable($r, "Topp $limit verst seeduðu Torrent <font class=small>(með minnst 5 a&eth; s&aelig;kja)</font>" . ($limit == 10 && $pu ? " <font class=small> - [<a href=topten.php?type=2&amp;lim=25&amp;subtype=wse>Topp 25</a>] - [<a href=topten.php?type=2&amp;lim=50&amp;subtype=wse>Topp 50</a>]</font>" : ""));
		}
  }

  end_main_frame();
  stdfoot();
?>
예제 #6
0
파일: topten.php 프로젝트: CptTZ/NexusPHP
     }
     if ($limit == 10 || $subtype == "sna") {
         $r = sql_query("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}") or sqlerr();
         _torrenttable($r, $lang_topten['text_top'] . "{$limit} " . $lang_topten['text_most_snatched_torrents'] . ($limit == 10 ? " <font class=\"small\"> - [<a class=\"altlink\" href=\"topten.php?type={$type}&lim=25&subtype=sna\">Top 25</a>] - [<a class=\"altlink\" href=\"topten.php?type={$type}&amp;lim=50&amp;subtype=sna\">Top 50</a>]</font>" : ""));
     }
     if ($limit == 10 || $subtype == "mdt") {
         $r = sql_query("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 times_completed > 0 GROUP BY t.id ORDER BY data DESC, added ASC LIMIT {$limit}") or sqlerr();
         _torrenttable($r, $lang_topten['text_top'] . "{$limit} " . $lang_topten['text_most_data_transferred_torrents'] . ($limit == 10 ? " <font class=\"small\"> - [<a class=\"altlink\" href=\"topten.php?type={$type}&amp;lim=25&amp;subtype=mdt\">Top 25</a>] - [<a class=\"altlink\" href=\"topten.php?type={$type}&amp;lim=50&amp;subtype=mdt\">Top 50</a>]</font>" : ""));
     }
     if ($limit == 10 || $subtype == "bse") {
         $r = sql_query("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}") or sqlerr();
         _torrenttable($r, $lang_topten['text_top'] . "{$limit} " . $lang_topten['text_best_seeded_torrents'] . "<font class=\"small\">" . $lang_topten['text_best_seeded_torrents_note'] . "</font>" . ($limit == 10 ? " <font class=\"small\"> - [<a class=\"altlink\" href=\"topten.php?type={$type}&amp;lim=25&amp;subtype=bse\">Top 25</a>] - [<a class=\"altlink\" href=\"topten.php?type={$type}&amp;lim=50&amp;subtype=bse\">Top 50</a>]</font>" : ""));
     }
     if ($limit == 10 || $subtype == "wse") {
         $r = sql_query("SELECT t.*, (t.size * t.times_completed) AS data FROM torrents AS t WHERE leechers > 0 AND times_completed > 0 ORDER BY seeders / leechers ASC, leechers DESC LIMIT {$limit}") or sqlerr();
         _torrenttable($r, $lang_topten['text_top'] . "{$limit} " . $lang_topten['text_worst_seeded_torrents'] . "<font class=\"small\">" . $lang_topten['text_worst_seeded_torrents_note'] . "</font>" . ($limit == 10 ? " <font class=\"small\"> - [<a class=\"altlink\" href=\"topten.php?type={$type}&amp;lim=25&amp;subtype=wse\">Top 25</a>] - [<a class=\"altlink\" href=\"topten.php?type={$type}&amp;lim=50&amp;subtype=wse\">Top 50</a>]</font>" : ""));
     }
 } elseif ($type == 3) {
     if ($limit == 10 || $subtype == "us") {
         $r = sql_query("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}") or sqlerr();
         countriestable($r, $lang_topten['text_top'] . "{$limit} " . $lang_topten['text_countries_users'] . ($limit == 10 ? " <font class=\"small\"> - [<a class=\"altlink\" href=\"topten.php?type={$type}&amp;lim=25&amp;subtype=us\">Top 25</a>]</font>" : ""), $lang_topten['col_users']);
     }
     if ($limit == 10 || $subtype == "ul") {
         $r = sql_query("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}") or sqlerr();
         countriestable($r, $lang_topten['text_top'] . "{$limit} " . $lang_topten['text_countries_uploaded'] . ($limit == 10 ? " <font class=\"small\"> - [<a class=\"altlink\" href=\"topten.php?type={$type}&amp;lim=25&amp;subtype=ul\">Top 25</a>]</font>" : ""), $lang_topten['col_uploaded']);
     }
     if ($limit == 10 || $subtype == "avg") {
         $r = sql_query("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}") or sqlerr();
         countriestable($r, $lang_topten['text_top'] . "{$limit} " . $lang_topten['text_countries_per_user'] . ($limit == 10 ? " <font class=\"small\"> - [<a class=\"altlink\" href=\"topten.php?type={$type}&amp;lim=25&amp;subtype=avg\">Top 25</a>]</font>" : ""), $lang_topten['col_average']);
     }
     if ($limit == 10 || $subtype == "r") {