<?
//
// H-Tracker v0.2
// http://h-tracker.org
// Based on TorrentTrader (http://www.torrenttrader.org)
//
//
require_once("backend/functions.php");
dbconn(false);
loggedinonly();
$site_config["RIGHTNAV"] = false;
$site_config["LEFTNAV"] = false;
if ($user["privacy"] != "strong" || ($CURUSER["control_panel"] == "yes")) {
function peerstable($res){
$ret = "<table align=center cellpadding=\"3\" cellspacing=\"0\" class=\"table_table\" width=\"95%\" border=\"1\"><tr><td class=table_head>" . NAME . "</td><td class=table_head align=center>" . SIZE . "</td><td class=table_head align=center>" . UPLOADED . "</td>\n<td class=table_head align=center>" . DOWNLOADED . "</td><td class=table_head align=center>" . RATIO . "</td></tr>\n";
while ($arr = mysql_fetch_assoc($res)){
$res2 = mysql_query("SELECT name,size FROM torrents WHERE id=$arr[torrent] ORDER BY name");
$arr2 = mysql_fetch_assoc($res2);
if ($arr["downloaded"] > 0){
$ratio = number_format($arr["uploaded"] / $arr["downloaded"], 2);
}else{
$ratio = "---";
}
$ret .= "<tr><td class=table_col1><a href=torrents-details.php?id=$arr[torrent]&hit=1><b>" . htmlspecialchars($arr2["name"]) . "</b></a></td><td align=center class=table_col2>" . mksize($arr2["size"]) . "</td><td align=center class=table_col1>" . mksize($arr["uploaded"]) . "</td><td align=center class=table_col2>" . mksize($arr["downloaded"]) . "</td><td align=center class=table_col1><font color=".get_ratio_color($ratio).">$ratio</font></td></tr>\n";
}
$ret .= "</table>\n";
return $ret;
}
stdhead("User CP");
begin_frame("Local Activity");
$res = mysql_query("SELECT torrent,uploaded,downloaded FROM peers WHERE userid='$id' AND seeder='yes'");
if (mysql_num_rows($res) > 0)
$seeding = peerstable($res);
$res = mysql_query("SELECT torrent,uploaded,downloaded FROM peers WHERE userid='$id' AND seeder='no'");
if (mysql_num_rows($res) > 0)
$leeching = peerstable($res);
if ($seeding)
print("<B>" . CURRENTLY_SEEDING . ":</B><BR>$seeding<BR><BR>");
if ($leeching)
print("<B>" . CURRENTLY_LEECHING . ":</B><BR>$leeching<BR><BR>");
if (!$leeching && !$seeding)
print("<B>This member currently has no active transfers<BR><BR>");
end_frame();
begin_frame("Uploaded Torrents");
//page numbers
$page = $_GET['page'];
$perpage = 25;
if ($CURUSER['control_panel'] != "yes")
$where = "AND anon='no'";
$res = mysql_query("SELECT COUNT(*) FROM torrents WHERE owner='$id' $where") or die(mysql_error());
$row = mysql_fetch_array($res);
$count = $row[0];
unset($where);
$orderby = "ORDER BY id DESC";
//get sql info
if ($count) {
list($pagertop, $pagerbottom, $limit) = pager($perpage, $count, "account-details.php?id=$id&" . $addparam);
$query = "SELECT torrents.id, torrents.category, torrents.leechers, torrents.nfo, torrents.seeders, torrents.name, torrents.times_completed, torrents.size, torrents.added, torrents.comments, torrents.numfiles, torrents.filename, torrents.owner, torrents.external, torrents.freeleech, categories.name AS cat_name, categories.parent_cat AS cat_parent, categories.image AS cat_pic, users.username, users.privacy, torrents.anon, IF(torrents.numratings < 2, NULL, ROUND(torrents.ratingsum / torrents.numratings, 1)) AS rating, torrents.announce FROM torrents LEFT JOIN categories ON category = categories.id LEFT JOIN users ON torrents.owner = users.id WHERE owner = $id $orderby $limit";
$res = mysql_query($query) or die(mysql_error());
}else{
unset($res);
}
if ($count) {
print($pagerbottom);
torrenttable($res);
print($pagerbottom);
}else {
print("<B>This member has not uploaded any torrents<BR><BR>");
}
end_frame();
stdfoot();
}
?>