Files
nexusphp/public/ipcheck.php

98 lines
3.2 KiB
PHP
Raw Permalink Normal View History

2020-12-26 01:42:23 +08:00
<?php
2021-01-13 19:32:26 +08:00
require "../include/bittorrent.php";
2020-12-26 01:42:23 +08:00
dbconn();
loggedinorreturn();
if (get_user_class() < UC_MODERATOR)
stderr("Sorry", "Access denied.");
2022-10-04 18:43:00 +08:00
$tabs = ['users', 'peers'];
$tab = 'users';
if (!empty($_REQUEST['tab']) && in_array($_REQUEST['tab'], $tabs)) {
$tab = $_REQUEST['tab'];
}
$page = $_REQUEST['page'] ?? 0;
$title = 'Duplicate IP users';
stdhead($title);
print '<h1>'.$title.'</h1>';
//print '<ul class="menu" style="padding-inline-start: 0">';
//foreach ($tabs as $item) {
// echo sprintf('<li class="%s"><a href="?tab=%s&page=%s">%s</a></li>', $tab == $item ? 'selected' : '', $item, $page, $item);
//}
//print '</ul>';
2020-12-26 01:42:23 +08:00
begin_table();
if (get_user_class() >= UC_MODERATOR || $CURUSER["guard"] == "yes")
{
$res = sql_query("SELECT count(*) AS dupl, ip FROM users WHERE enabled = 'yes' AND ip <> '' AND ip <> '127.0.0.0' GROUP BY ip ORDER BY dupl DESC, ip") or sqlerr();
print("<tr align=center><td class=colhead width=90>User</td>
<td class=colhead width=70>Email</td>
<td class=colhead width=70>Registered</td>
<td class=colhead width=75>Last access</td>
<td class=colhead width=70>Downloaded</td>
<td class=colhead width=70>Uploaded</td>
<td class=colhead width=45>Ratio</td>
<td class=colhead width=125>IP</td>
<td class=colhead width=40>Peer</td></tr>\n");
$uc = 0;
2021-01-07 17:35:00 +08:00
$ip = '';
2020-12-26 01:42:23 +08:00
while($ras = mysql_fetch_assoc($res))
{
if ($ras["dupl"] <= 1)
break;
if ($ip <> $ras['ip'])
{
$ros = sql_query("SELECT id, username, email, added, last_access, downloaded, uploaded, ip, warned, donor, enabled FROM users WHERE ip='".$ras['ip']."' ORDER BY id") or sqlerr();
$num2 = mysql_num_rows($ros);
if ($num2 > 1)
{
$uc++;
while($arr = mysql_fetch_assoc($ros))
{
2021-01-19 17:35:05 +08:00
if ($arr['added'] == '0000-00-00 00:00:00' || $arr['added'] == null)
2020-12-26 01:42:23 +08:00
$arr['added'] = '-';
2021-01-19 17:35:05 +08:00
if ($arr['last_access'] == '0000-00-00 00:00:00' || $arr['last_access'] == null)
2020-12-26 01:42:23 +08:00
$arr['last_access'] = '-';
if($arr["downloaded"] != 0)
$ratio = number_format($arr["uploaded"] / $arr["downloaded"], 3);
else
$ratio="---";
2022-10-04 18:43:00 +08:00
2020-12-26 01:42:23 +08:00
$ratio = "<font color=" . get_ratio_color($ratio) . ">$ratio</font>";
$uploaded = mksize($arr["uploaded"]);
$downloaded = mksize($arr["downloaded"]);
$added = substr($arr['added'],0,10);
$last_access = substr($arr['last_access'],0,10);
if($uc%2 == 0)
$utc = "";
else
$utc = " bgcolor=\"ECE9D8\"";
2022-10-04 18:43:00 +08:00
2020-12-26 01:42:23 +08:00
$peer_res = sql_query("SELECT count(*) FROM peers WHERE ip = " . sqlesc($ras['ip']) . " AND userid = " . $arr['id']);
$peer_row = mysql_fetch_row($peer_res);
print("<tr$utc><td align=left>" . get_username($arr["id"])."</td>
<td align=center>$arr[email]</td>
<td align=center>$added</td>
<td align=center>$last_access</td>
<td align=center>$downloaded</td>
<td align=center>$uploaded</td>
<td align=center>$ratio</td>
2022-10-04 18:43:00 +08:00
<td align=center><a href=\"http://www.whois.sc/$arr[ip]\" target=\"_blank\">$arr[ip]</a></td>\n<td align=center>" .
2020-12-26 01:42:23 +08:00
($peer_row[0] ? "ja" : "nein") . "</td></tr>\n");
$ip = $arr["ip"];
}
}
}
}
}
else
{
print("<br /><table width=60% border=1 cellspacing=0 cellpadding=9><tr><td align=center>");
print("<h2>Sorry, only for Team</h2></table></td></tr>");
}
end_frame();
end_table();
stdfoot();
?>