Exemplo n.º 1
0
    }
    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__);
        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>" : ""), "Среднее");
    }
    if ($limit == 10 || $subtype == "r") {
        $r = sql_query("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}") or sqlerr(__FILE__, __LINE__);
        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>" : ""), "Рейитнг");
    }
} elseif ($type == 4) {
    print "<h1 align=center><font color=red>Under construction!</font></h1>\n";
    if (!$limit || $limit > 250) {
        $limit = 10;
    }
    if ($limit == 10 || $subtype == "ul") {
        //				$r = sql_query("SELECT users.id AS userid, peers.id AS peerid, username, peers.uploaded, peers.downloaded, peers.uploaded / (UNIX_TIMESTAMP(NOW()) - (UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(last_action)) - UNIX_TIMESTAMP(started)) AS uprate, peers.downloaded / (UNIX_TIMESTAMP(NOW()) - (UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(last_action)) - UNIX_TIMESTAMP(started)) AS downrate FROM peers LEFT JOIN users ON peers.userid = users.id ORDER BY uprate DESC LIMIT $limit") or sqlerr(__FILE__, __LINE__);
        //				peerstable($r, "Top $limit Fastest Uploaders" . ($limit == 10 && $pu ? " <font class=small> - [<a href=topten.php?type=4&amp;lim=100&amp;subtype=ul>Top 100</a>] - [<a href=topten.php?type=4&amp;lim=250&amp;subtype=ul>Top 250</a>]</font>" : ""));
        //				$r = sql_query("SELECT users.id AS userid, peers.id AS peerid, username, peers.uploaded, peers.downloaded, (peers.uploaded - peers.uploadoffset) / (UNIX_TIMESTAMP(last_action) - UNIX_TIMESTAMP(started)) AS uprate, (peers.downloaded - peers.downloadoffset) / (UNIX_TIMESTAMP(last_action) - UNIX_TIMESTAMP(started)) AS downrate FROM peers LEFT JOIN users ON peers.userid = users.id ORDER BY uprate DESC LIMIT $limit") or sqlerr(__FILE__, __LINE__);
        //				peerstable($r, "Top $limit Fastest Uploaders (timeout corrected)" . ($limit == 10 && $pu ? " <font class=small> - [<a href=topten.php?type=4&amp;lim=100&amp;subtype=ul>Top 100</a>] - [<a href=topten.php?type=4&amp;lim=250&amp;subtype=ul>Top 250</a>]</font>" : ""));
        $r = sql_query("SELECT users.id AS userid, username, (peers.uploaded - peers.uploadoffset) / (UNIX_TIMESTAMP(last_action) - UNIX_TIMESTAMP(started)) AS uprate, IF(seeder = 'yes',(peers.downloaded - peers.downloadoffset)  / (finishedat - UNIX_TIMESTAMP(started)),(peers.downloaded - peers.downloadoffset) / (UNIX_TIMESTAMP(last_action) - UNIX_TIMESTAMP(started))) AS downrate FROM peers LEFT JOIN users ON peers.userid = users.id ORDER BY uprate DESC LIMIT {$limit}") or sqlerr(__FILE__, __LINE__);
        peerstable($r, "Top {$limit} Fastest Uploaders" . ($limit == 10 && $pu ? " <font class=small> - [<a href=topten.php?type=4&amp;lim=100&amp;subtype=ul>Top 100</a>] - [<a href=topten.php?type=4&amp;lim=250&amp;subtype=ul>Top 250</a>]</font>" : ""));
    }
    if ($limit == 10 || $subtype == "dl") {
Exemplo n.º 2
0
    }
    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();
        $HTMLOUT .= countriestable($r, sprintf($lang['country_avperuser'], $limit) . ($limit == 10 && $pu ? " <font class='small'> - [<a href='topten.php?type=3&amp;lim=25&amp;subtype=avg'>{$lang['common_top25']}</a>]</font>" : ""), $lang['country_avg']);
    }
    if ($limit == 10 || $subtype == "r") {
        $r = sql_query("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}") or sqlerr();
        $HTMLOUT .= countriestable($r, sprintf($lang['country_ratio'], $limit) . ($limit == 10 && $pu ? " <font class='small'> - [<a href='topten.php?type=3&amp;lim=25&amp;subtype=r'>{$lang['common_top25']}</a>]</font>" : ""), $lang['common_ratio']);
    }
} elseif ($type == 4) {
    //		print("<h1 align='center'><font color=''red''>Under construction!</font></h1>\n");
    if (!$limit || $limit > 250) {
        $limit = 10;
    }
    if ($limit == 10 || $subtype == "ul") {
        //				$r = sql_query("SELECT users.id AS userid, peers.id AS peerid, username, peers.uploaded, peers.downloaded, peers.uploaded / (UNIX_TIMESTAMP(NOW()) - (UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(last_action)) - UNIX_TIMESTAMP(started)) AS uprate, peers.downloaded / (UNIX_TIMESTAMP(NOW()) - (UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(last_action)) - UNIX_TIMESTAMP(started)) AS downrate FROM peers LEFT JOIN users ON peers.userid = users.id ORDER BY uprate DESC LIMIT $limit") or sqlerr();
        //				peerstable($r, "Top $limit Fastest Uploaders" . ($limit == 10 && $pu ? " <font class='small'> - [<a href='topten.php?type=4&amp;lim=100&amp;subtype=ul'>Top 100</a>] - [<a href='topten.php?type=4&amp;lim=250&amp;subtype=ul'>Top 250</a>]</font>" : ""));
        //				$r = sql_query("SELECT users.id AS userid, peers.id AS peerid, username, peers.uploaded, peers.downloaded, (peers.uploaded - peers.uploadoffset) / (UNIX_TIMESTAMP(last_action) - UNIX_TIMESTAMP(started)) AS uprate, (peers.downloaded - peers.downloadoffset) / (UNIX_TIMESTAMP(last_action) - UNIX_TIMESTAMP(started)) AS downrate FROM peers LEFT JOIN users ON peers.userid = users.id ORDER BY uprate DESC LIMIT $limit") or sqlerr();
        //				peerstable($r, "Top $limit Fastest Uploaders (timeout corrected)" . ($limit == 10 && $pu ? " <font class='small'> - [<a href='topten.php?type=4&amp;lim=100&amp;subtype=ul'>Top 100</a>] - [<a href='topten.php?type=4&amp;lim=250&amp;subtype=ul'>Top 250</a>]</font>" : ""));
        $r = sql_query("SELECT users.id AS userid, username, (peers.uploaded - peers.uploadoffset) / (last_action - started) AS uprate, IF(seeder = 'yes',(peers.downloaded - peers.downloadoffset)  / (finishedat - started),(peers.downloaded - peers.downloadoffset) / (last_action - started)) AS downrate FROM peers LEFT JOIN users ON peers.userid = users.id ORDER BY uprate DESC LIMIT {$limit}") or sqlerr();
        $HTMLOUT .= peerstable($r, sprintf($lang['peers_fastestup'], $limit) . ($limit == 10 && $pu ? " <font class='small'> - [<a href='topten.php?type=4&amp;lim=100&amp;subtype=ul'>{$lang['common_top100']}</a>] - [<a href='topten.php?type=4&amp;lim=250&amp;subtype=ul'>{$lang['common_top250']}</a>]</font>" : ""));
    }
    if ($limit == 10 || $subtype == "dl") {
Exemplo n.º 3
0
 } 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") {
         $r = sql_query("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}") or sqlerr();
         countriestable($r, $lang_topten['text_top'] . "{$limit} " . $lang_topten['text_countries_ratio'] . ($limit == 10 ? " <font class=\"small\"> - [<a class=\"altlink\" href=\"topten.php?type={$type}&amp;lim=25&amp;subtype=r\">Top 25</a>]</font>" : ""), $lang_topten['col_ratio']);
     }
 } elseif ($type == 5) {
     if ($limit == 10 || $subtype == "mtop") {
         $r = sql_query("SELECT users_topics.userid,  users_topics.usertopics, COUNT(posts.id) as userposts FROM (SELECT users.id as userid, COUNT(topics.id) as usertopics from users LEFT JOIN topics ON users.id = topics.userid GROUP BY users.id) as users_topics LEFT JOIN posts ON users_topics.userid = posts.userid GROUP BY users_topics.userid ORDER BY usertopics DESC LIMIT {$limit}") or sqlerr();
         postable($r, $lang_topten['text_top'] . "{$limit} " . $lang_topten['text_most_topic'] . ($limit == 10 ? " <font class=\"small\"> - [<a class=\"altlink\" href=\"topten.php?type={$type}&amp;lim=100&amp;subtype=mtop\">" . $lang_topten['text_one_hundred'] . "</a>] - [<a class=\"altlink\" href=\"topten.php?type={$type}&amp;lim=250&amp;subtype=mtop\">" . $lang_topten['text_top_250'] . "</a>]</font>" : ""));
     }
     if ($limit == 10 || $subtype == "mpos") {
         $r = sql_query("SELECT users_topics.userid,  users_topics.usertopics, COUNT(posts.id) as userposts FROM (SELECT users.id as userid, COUNT(topics.id) as usertopics from users LEFT JOIN topics ON users.id = topics.userid GROUP BY users.id) as users_topics LEFT JOIN posts ON users_topics.userid = posts.userid GROUP BY users_topics.userid ORDER BY userposts DESC LIMIT {$limit}") or sqlerr();
         postable($r, $lang_topten['text_top'] . "{$limit} " . $lang_topten['text_most_post'] . ($limit == 10 ? " <font class=\"small\"> - [<a class=\"altlink\" href=\"topten.php?type={$type}&amp;lim=100&amp;subtype=mpos\">" . $lang_topten['text_one_hundred'] . "</a>] - [<a class=\"altlink\" href=\"topten.php?type={$type}&amp;lim=250&amp;subtype=mpos\">" . $lang_topten['text_top_250'] . "</a>]</font>" : ""));
     }
     if ($reviewenabled == 'yes' && ($limit == 10 || $subtype == "mrev")) {
         $r = sql_query("SELECT users.id as userid, COUNT(reviews.id) as num FROM users LEFT JOIN reviews ON users.id = reviews.user GROUP BY users.id ORDER BY num DESC LIMIT {$limit}") or sqlerr();
         cmttable($r, $lang_topten['text_top'] . "{$limit} " . $lang_topten['text_most_reviewer'] . ($limit == 10 ? " <font class=\"small\"> - [<a class=\"altlink\" href=\"topten.php?type={$type}&amp;lim=100&amp;subtype=mrev\">" . $lang_topten['text_one_hundred'] . "</a>] - [<a class=\"altlink\" href=\"topten.php?type={$type}&amp;lim=250&amp;subtype=mrev\">" . $lang_topten['text_top_250'] . "</a>]</font>" : ""), $lang_topten['col_reviews']);
     }
     if ($limit == 10 || $subtype == "mcmt") {