Gazelle/sections/tools/misc/dupe_ip.php

65 lines
1.9 KiB
PHP
Raw Normal View History

2011-03-28 14:21:28 +00:00
<?
if(!check_perms('users_view_ips')) { error(403); }
2012-10-11 08:00:15 +00:00
View::show_header('Dupe IPs');
2011-03-28 14:21:28 +00:00
define('USERS_PER_PAGE', 50);
define('IP_OVERLAPS', 5);
2012-10-11 08:00:15 +00:00
list($Page,$Limit) = Format::page_limit(USERS_PER_PAGE);
2011-03-28 14:21:28 +00:00
$RS = $DB->query("SELECT
SQL_CALC_FOUND_ROWS
m.ID,
m.IP,
m.Username,
m.PermissionID,
m.Enabled,
i.Donor,
i.Warned,
i.JoinDate,
(SELECT COUNT(DISTINCT h.UserID) FROM users_history_ips AS h WHERE h.IP=m.IP) AS Uses
FROM users_main AS m
LEFT JOIN users_info AS i ON i.UserID=m.ID
WHERE (SELECT COUNT(DISTINCT h.UserID) FROM users_history_ips AS h WHERE h.IP=m.IP) >= ".IP_OVERLAPS."
AND m.Enabled = '1'
AND m.IP != '127.0.0.1'
ORDER BY Uses DESC LIMIT $Limit");
$DB->query("SELECT FOUND_ROWS()");
list($Results) = $DB->next_record();
$DB->set_query_id($RS);
if($DB->record_count()) {
?>
<div class="linkbox">
<?
2012-10-11 08:00:15 +00:00
$Pages=Format::get_pages($Page,$Results,USERS_PER_PAGE, 11) ;
2011-03-28 14:21:28 +00:00
echo $Pages;
?>
</div>
<table width="100%">
<tr class="colhead">
<td>User</td>
2013-02-09 08:01:01 +00:00
<td>IP address</td>
2011-03-28 14:21:28 +00:00
<td>Dupes</td>
<td>Registered</td>
</tr>
<?
while(list($UserID, $IP, $Username, $PermissionID, $Enabled, $Donor, $Warned, $Joined, $Uses)=$DB->next_record()) {
$Row = ($Row == 'b') ? 'a' : 'b';
?>
<tr class="row<?=$Row?>">
2012-10-11 08:00:15 +00:00
<td><?=Users::format_username($UserID, true, true, true, true)?></td>
2013-02-09 08:01:01 +00:00
<td><span style="float:left;"><?=Tools::get_host_by_ajax($IP)." ($IP)"?></span><span style="float:right;"><a href="userhistory.php?action=ips&amp;userid=<?=$UserID?>" title="History" class="brackets">H</a> <a href="user.php?action=search&amp;ip_history=on&amp;ip=<?=display_str($IP)?>" title="Search" class="brackets">S</a></span></td>
2011-03-28 14:21:28 +00:00
<td><?=display_str($Uses)?></td>
<td><?=time_diff($Joined)?></td>
</tr>
<? } ?>
</table>
<div class="linkbox">
<? echo $Pages; ?>
</div>
<? } else { ?>
<h2 align="center">There are currently no users with more than <?=IP_OVERLAPS?> IP overlaps.</h2>
<? }
2012-10-11 08:00:15 +00:00
View::show_footer();
2011-03-28 14:21:28 +00:00
?>