require "include/bittorrent.php";
dbconn();
loggedinorreturn();
if (get_user_class() < UC_MODERATOR)
stderr("Error", "Permission denied.");
stdhead("Stats");
?>
a.colheadlink:link, a.colheadlink:visited{
font-weight: bold;
color: #FFFFFF;
text-decoration: none;
}
a.colheadlink:hover {
text-decoration: underline;
}
begin_main_frame();
$res = sql_query("SELECT COUNT(*) FROM torrents") or sqlerr(__FILE__, __LINE__);
$n = mysql_fetch_row($res);
$n_tor = $n[0];
$res = sql_query("SELECT COUNT(*) FROM peers") or sqlerr(__FILE__, __LINE__);
$n = mysql_fetch_row($res);
$n_peers = $n[0];
$uporder = $_GET['uporder'];
$catorder = $_GET["catorder"];
if ($uporder == "lastul")
$orderby = "last DESC, name";
elseif ($uporder == "torrents")
$orderby = "n_t DESC, name";
elseif ($uporder == "peers")
$orderby = "n_p DESC, name";
else
$orderby = "name";
$query = "SELECT u.id, u.username AS name, MAX(t.added) AS last, COUNT(DISTINCT t.id) AS n_t, COUNT(p.id) as n_p
FROM users as u LEFT JOIN torrents as t ON u.id = t.owner LEFT JOIN peers as p ON t.id = p.torrent WHERE u.class = 3
GROUP BY u.id UNION SELECT u.id, u.username AS name, MAX(t.added) AS last, COUNT(DISTINCT t.id) AS n_t, COUNT(p.id) as n_p
FROM users as u LEFT JOIN torrents as t ON u.id = t.owner LEFT JOIN peers as p ON t.id = p.torrent WHERE u.class > 3
GROUP BY u.id ORDER BY $orderby";
$res = sql_query($query) or sqlerr(__FILE__, __LINE__);
if (mysql_num_rows($res) == 0)
stdmsg("Sorry...", "No uploaders.");
else
{
begin_frame("Uploader Activity", True);
begin_table();
print("
\n Uploader\n Last Upload\n Torrents\nPerc.\n Peers\nPerc.\n\n");while ($uper = mysql_fetch_array($res))
{
print("
" . get_username($uper['id']) . "\n");print("
".$uper['last']." (".get_elapsed_time(strtotime($uper['last']))." ago)"):"align=center>---") . "\n");print("
" . $uper['n_t'] . "\n");print("
" . ($n_tor > 0?number_format(100 * $uper['n_t']/$n_tor,1)."%":"---") . "\n");print("
" . $uper['n_p']."\n");print("
" . ($n_peers > 0?number_format(100 * $uper['n_p']/$n_peers,1)."%":"---") . "\n");}
end_table();
end_frame();
}
if ($n_tor == 0)
stdmsg("Sorry...", "No categories defined!");
else
{
if ($catorder == "lastul")
$orderby = "last DESC, c.name";
elseif ($catorder == "torrents")
$orderby = "n_t DESC, c.name";
elseif ($catorder == "peers")
$orderby = "n_p DESC, name";
else
$orderby = "c.name";
$res = sql_query("SELECT c.name, MAX(t.added) AS last, COUNT(DISTINCT t.id) AS n_t, COUNT(p.id) AS n_p
FROM categories as c LEFT JOIN torrents as t ON t.category = c.id LEFT JOIN peers as p
ON t.id = p.torrent GROUP BY c.id ORDER BY $orderby") or sqlerr(__FILE__, __LINE__);
begin_frame("Category Activity", True);
begin_table();
print("
Category Last Upload TorrentsPerc. PeersPerc.\n");while ($cat = mysql_fetch_array($res))
{
print("
" . $cat['name'] . "");print("
".$cat['last']." (".get_elapsed_time(strtotime($cat['last']))." ago)"):"align = center>---") ."");print("
" . $cat['n_t'] . "");print("
" . number_format(100 * $cat['n_t']/$n_tor,1) . "%");print("
" . $cat['n_p'] . "");print("
" . ($n_peers > 0?number_format(100 * $cat['n_p']/$n_peers,1)."%":"---") . "\n");}
end_table();
end_frame();
}
end_main_frame();
stdfoot();
die;
?>
一键复制
编辑
Web IDE
原始数据
按行查看
历史
本文展示了活跃上传者上传次数、最近上传时间和对应比例,以及各类别下载统计,帮助了解用户和类别在数据分享中的活跃情况。
9万+

被折叠的 条评论
为什么被折叠?



