require "include/bittorrent.php";
dbconn(false);
loggedinorreturn();
function bark($msg)
{
stdhead();
stdmsg("Error", $msg);
stdfoot();
exit;
}
function maketable($res)
{
$ret = "
" .
"| Type | Name | TTL | Size | Se. | Le. | Upl. | \n" .
"Downl. | Ratio |
\n";
while ($arr = mysql_fetch_assoc($res))
{
if ($arr["downloaded"] > 0)
{
$ratio = number_format($arr["uploaded"] / $arr["downloaded"], 3);
$ratio = "$ratio";
}
else
if ($arr["uploaded"] > 0)
$ratio = "Inf.";
else
$ratio = "---";
$catimage = htmlspecialchars($arr["image"]);
$catname = htmlspecialchars($arr["catname"]);
$ttl = (28*24) - floor((gmtime() - sql_timestamp_to_unix_timestamp($arr["added"])) / 3600);
if ($ttl == 1) $ttl .= "
hour"; else $ttl .= "
hours";
$size = str_replace(" ", "
", mksize($arr["size"]));
$uploaded = str_replace(" ", "
", mksize($arr["uploaded"]));
$downloaded = str_replace(" ", "
", mksize($arr["downloaded"]));
$seeders = number_format($arr["seeders"]);
$leechers = number_format($arr["leechers"]);
$ret .= " | \n" .
"" . htmlspecialchars($arr["torrentname"]) . " | $ttl | $size | $seeders | $leechers | $uploaded | \n" .
"$downloaded | $ratio |
\n";
}
$ret .= "
\n";
return $ret;
}
$id = 0 + $_GET["id"];
if (!is_valid_id($id))
bark("Bad ID $id.");
$r = @mysql_query("SELECT * FROM users WHERE id=$id") or sqlerr();
$user = mysql_fetch_array($r) or bark("No user with ID $id.");
if ($user["status"] == "pending") die;
if($user["anonymous"] == "no")
$viewprof = 1;
elseif($CURUSER["id"] == '$id' OR get_user_class() >= UC_MODERATOR)
$viewprof = 1;
if($viewprof == 1){
$r = mysql_query("SELECT id, name, seeders, leechers, category FROM torrents WHERE owner=$id ORDER BY name") or sqlerr();
if (mysql_num_rows($r) > 0)
{
$torrents = "
\n" .
"| Type | Name | Seeders | |
class=colhead>Leechers
\n";
while ($a = mysql_fetch_assoc($r))
{
$r2 = mysql_query("SELECT name, image FROM categories WHERE id=$a[category]") or sqlerr(__FILE__, __LINE__);
$a2 = mysql_fetch_assoc($r2);
$cat = "
";
$torrents .= "| $cat | " .
htmlspecialchars($a["name"]) . " | " .
"$a[seeders] | $a[leechers] |
\n";
}
$torrents .= "
";
}
}
if ($user["ip"] && (get_user_class() >= UC_MODERATOR || $user["id"] == $CURUSER["id"]))
{
$ip = $user["ip"];
$dom = @gethostbyaddr($user["ip"]);
if ($dom == $user["ip"] || @gethostbyname($dom) != $user["ip"])
$addr = $ip;
else
{
$dom = strtoupper($dom);
$domparts = explode(".", $dom);
$domain = $domparts[count($domparts) - 2];
if ($domain == "COM" || $domain == "CO" || $domain == "NET" || $domain == "NE" || $domain == "ORG" || $domain == "OR" )
$l = 2;
else
$l = 1;
$addr = "$ip ($dom)";
}
}
if ($user[added] == "0000-00-00 00:00:00")
$joindate = 'N/A';
else
$joindate = "$user[added] (" . get_elapsed_time(sql_timestamp_to_unix_timestamp($user["added"])) . " ago)";
$lastseen = $user["last_access"];
if ($lastseen == "0000-00-00 00:00:00")
$lastseen = "never";
else
{
$lastseen .= " (" . get_elapsed_time(sql_timestamp_to_unix_timestamp($lastseen)) . " ago)";
}
$res = mysql_query("SELECT COUNT(*) FROM comments WHERE user=" . $user[id]) or sqlerr();
$arr3 = mysql_fetch_row($res);
$torrentcomments = $arr3[0];
$res = mysql_query("SELECT COUNT(*) FROM posts WHERE userid=" . $user[id]) or sqlerr();
$arr3 = mysql_fetch_row($res);
$forumposts = $arr3[0];
//if ($user['donated'] > 0)
// $don = "

";
$res = mysql_query("SELECT name,flagpic FROM countries WHERE id=$user[country] LIMIT 1") or sqlerr();
if (mysql_num_rows($res) == 1)
{
$arr = mysql_fetch_assoc($res);
$country = "
![\"$arr[name]\"](/pic/flag/$arr[flagpic]) | ";
}
//if ($user["donor"] == "yes") $donor = "
 | ";
//if ($user["warned"] == "yes") $warned = "
 | ";
if($user["anonymous"] == "no")
$viewprof = 1;
elseif($CURUSER["id"] == $id OR get_user_class() >= UC_MODERATOR)
$viewprof = 1;
if($viewprof == 1){
$res = mysql_query("SELECT torrent,added,uploaded,downloaded,torrents.name as torrentname,categories.name as
catname,size,image,category,seeders,leechers FROM peers JOIN torrents ON peers.torrent = torrents.id JOIN categories ON torrents.category =
categories.id WHERE userid=$id AND seeder='no'") or sqlerr();
if (mysql_num_rows($res) > 0)
$leeching = maketable($res);
$res = mysql_query("SELECT torrent,added,uploaded,downloaded,torrents.name as torrentname,categories.name as
catname,size,image,category,seeders,leechers FROM peers JOIN torrents ON peers.torrent = torrents.id JOIN categories ON torrents.category =
categories.id WHERE userid=$id AND seeder='yes'") or sqlerr();
if (mysql_num_rows($res) > 0)
$seeding = maketable($res);
}
stdhead("Details for " . $user["username"]);
$enabled = $user["enabled"] == 'yes';
print("
".
"$user[username]" . get_user_icons($user, true) . " | $country
\n");
if (!$enabled)
print("
This account has been disabled
\n");
elseif ($CURUSER["id"] <> $user["id"])
{
$r = mysql_query("SELECT id FROM friends WHERE userid=$CURUSER[id] AND friendid=$id") or sqlerr(__FILE__, __LINE__);
$friend = mysql_num_rows($r);
$r = mysql_query("SELECT id FROM blocks WHERE userid=$CURUSER[id] AND blockid=$id") or sqlerr(__FILE__, __LINE__);
$block = mysql_num_rows($r);
if ($friend)
print("
(remove from friends)
\n");
elseif($block)
print("
(remove from blocks)
\n");
else
{
print("
(add to friends)");
print(" - (add to blocks)
\n");
}
}
if ($user["hidestats"] == 'yes')
{
print("
");
if ($user["avatar"])
print(" |
\n");
if ($user["info"])
print("| " . format_comment($user["info"]) . " |
\n");
if (get_user_class() < UC_MODERATOR && $user["id"] != $CURUSER["id"])
{
print("
");
end_main_frame();
stdfoot();
exit;
}
print("
");
}
begin_main_frame();
?>
| Join date | =$joindate?> |
| Last seen | =$lastseen?> |
if (get_user_class() >= UC_MODERATOR)
print("| Email | $user[email] |
\n");
if ($addr)
print("| Address | $addr |
\n");
// if ($user["id"] == $CURUSER["id"] || get_user_class() >= UC_MODERATOR)
// {
?>
| Uploaded | =mksize($user["uploaded"])?> |
| Downloaded | =mksize($user["downloaded"])?> |
if ($user["downloaded"] > 0)
{
$sr = $user["uploaded"] / $user["downloaded"];
if ($sr >= 4)
$s = "w00t";
else if ($sr >= 2)
$s = "grin";
else if ($sr >= 1)
$s = "smile1";
else if ($sr >= 0.5)
$s = "noexpression";
else if ($sr >= 0.25)
$s = "sad";
else
$s = "cry";
$sr = floor($sr * 1000) / 1000;
$sr = "| " . number_format($sr, 3) . " |  |
";
print("| Share ratio | $sr |
\n");
}
//}
//if ($user['donated'] > 0 && (get_user_class() >= UC_MODERATOR || $CURUSER["id"] == $user["id"]))
// print("| Donated | $$user[donated] |
\n");
if ($user["avatar"])
print("| Avatar |  |
\n");
print("| Class | " . get_user_class_name($user["class"]) . " |
\n");
print("| Torrent comments | ");
if ($torrentcomments && (($user["class"] >= UC_POWER_USER && $user["id"] == $CURUSER["id"]) || get_user_class() >= UC_MODERATOR))
print("$torrentcomments |
\n");
else
print("$torrentcomments | \n");
print("| Forum posts | ");
if ($forumposts && (($user["class"] >= UC_POWER_USER && $user["id"] == $CURUSER["id"]) || get_user_class() >= UC_MODERATOR))
print("$forumposts |
\n");
else
print("$forumposts | \n");
if ($torrents)
print("| Uploaded torrents | $torrents |
\n");
if ($seeding)
print("| Currently seeding | $seeding |
\n");
if ($leeching)
print("| Currently leeching | $leeching |
\n");
if ($user["info"])
print("| " . format_comment($user["info"]) . " |
\n");
if ($CURUSER["id"] != $user["id"])
if (get_user_class() >= UC_MODERATOR)
$showpmbutton = 1;
elseif ($user["acceptpms"] == "yes")
{
$r = mysql_query("SELECT id FROM blocks WHERE userid=$user[id] AND blockid=$CURUSER[id]") or sqlerr(__FILE__,__LINE__);
$showpmbutton = (mysql_num_rows($r) == 1 ? 0 : 1);
}
elseif ($user["acceptpms"] == "friends")
{
$r = mysql_query("SELECT id FROM friends WHERE userid=$user[id] AND friendid=$CURUSER[id]") or sqlerr(__FILE__,__LINE__);
$showpmbutton = (mysql_num_rows($r) == 1 ? 1 : 0);
}
if ($showpmbutton)
print(" |
");
print("
\n");
if (get_user_class() >= UC_MODERATOR && $user["class"] < get_user_class())
{
begin_frame("Edit User", true);
print("
\n");
end_frame();
}
end_main_frame();
stdfoot();
?>
minutes of their live helping me... <3