require "include/bittorrent.php";
dbconn(false);
loggedinorreturn();
stdhead("Multiple IPs");
if (get_user_class() < UC_UPLOADER)
stderr( _("Error"), _("Permission denied."));
$res2 = do_mysql_query("SELECT count(ip) as count FROM users GROUP BY ip HAVING COUNT(ip)>2 AND sum(downloaded) > 0") or sqlerr(__FILE__, __LINE__);
while ($arr2 = mysql_fetch_assoc($res2))
{
$count++;
}
$perpage = 100;
list($pagertop, $pagerbottom, $limit) = pager($perpage, $count, $_SERVER["PHP_SELF"] ."?" );
$res = do_mysql_query("SELECT sum(uploaded) as uploaded, sum(downloaded) as downloaded, ip, sum(uploaded)/sum(downloaded) as ratio, count(ip) as count FROM users GROUP BY ip HAVING COUNT(ip)>2 AND sum(downloaded) > 0 ORDER BY ratio asc $limit") or sqlerr(__FILE__, __LINE__);
print("
Multiple IPs
\n");
if (mysql_num_rows($res) == 0)
print("Nothing to show\n");
else
{
echo $pagertop;
print("\n");
print("IP | Combined Ratio | Count | Enabled | Disabled |
\n");
while ($arr = mysql_fetch_assoc($res))
{
if($arr[ip]!="")
{
$host = @gethostbyaddr($arr[ip]);
if(!(stristr($host, "aol")) && !(stristr($host, "cache"))&& !(stristr($host, "proxy")))
{
$r = do_mysql_query("SELECT count(id) FROM users WHERE enabled = 'no' AND ip = '$arr[ip]' UNION SELECT count(id) FROM users WHERE enabled = 'yes' AND ip = '$arr[ip]'") or sqlerr();
$a = mysql_fetch_row($r);
$disabled = number_format(0 + $a[0]);
$a = mysql_fetch_row($r);
$enabled = number_format(0 + $a[0]);
$nip = ip2long($arr[ip]);
$auxres = do_mysql_query("SELECT COUNT(*) FROM bans WHERE $nip >= first AND $nip <= last") or sqlerr(__FILE__, __LINE__);
$array = mysql_fetch_row($auxres);
if ($array[0] == 0)
$ipstr = "Not Banned";
else
$ipstr = "IP Banned";
if ($arr["downloaded"] > 0)
{
$ratio = number_format($arr["uploaded"] / $arr["downloaded"], 3);
$ratio = "$ratio";
}
else
if ($arr["uploaded"] > 0)
$ratio = "Inf.";
else
$ratio = "---";
print("$arr[ip] ($host) - $ipstr | $ratio | $arr[count] | $enabled | $disabled |
\n");}
}}
print("
");
}
print("Times are in GMT.
\n");
echo $pagerbottom;
stdfoot();
?>