Gazelle/sections/tools/data/registration_log.php

149 lines
5.1 KiB
PHP
Raw Normal View History

2011-03-28 14:21:28 +00:00
<?
2013-05-02 08:00:23 +00:00
if (!check_perms('users_view_ips') || !check_perms('users_view_email')) {
error(403);
}
2012-10-11 08:00:15 +00:00
View::show_header('Registration log');
2011-03-28 14:21:28 +00:00
define('USERS_PER_PAGE', 50);
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
2013-03-15 08:00:47 +00:00
$AfterDate = $_POST['after_date'];
$BeforeDate = $_POST['before_date'];
$DateSearch = false;
2013-05-02 08:00:23 +00:00
if (!empty($AfterDate) && !empty($BeforeDate)) {
list($Y, $M, $D) = explode('-', $AfterDate);
if (!checkdate($M, $D, $Y)) {
error('Incorrect "after" date format');
2013-03-15 08:00:47 +00:00
}
2013-05-02 08:00:23 +00:00
list($Y, $M, $D) = explode('-', $BeforeDate);
if (!checkdate($M, $D, $Y)) {
error('Incorrect "before" date format');
2013-03-15 08:00:47 +00:00
}
$AfterDate = db_string($AfterDate);
$BeforeDate = db_string($BeforeDate);
$DateSearch = true;
}
2011-03-28 14:21:28 +00:00
2013-05-02 08:00:23 +00:00
$RS = "
SELECT
SQL_CALC_FOUND_ROWS
m.ID,
m.IP,
m.ipcc,
m.Email,
m.Username,
m.PermissionID,
m.Uploaded,
m.Downloaded,
m.Enabled,
i.Donor,
i.Warned,
i.JoinDate,
( SELECT COUNT(h1.UserID)
FROM users_history_ips AS h1
WHERE h1.IP=m.IP
) AS Uses,
im.ID,
im.IP,
im.ipcc,
im.Email,
im.Username,
im.PermissionID,
im.Uploaded,
im.Downloaded,
im.Enabled,
ii.Donor,
ii.Warned,
ii.JoinDate,
( SELECT COUNT(h2.UserID)
FROM users_history_ips AS h2
WHERE h2.IP=im.IP
) AS InviterUses
2013-02-22 08:00:24 +00:00
FROM users_main AS m
2013-05-02 08:00:23 +00:00
LEFT JOIN users_info AS i ON i.UserID=m.ID
LEFT JOIN users_main AS im ON i.Inviter = im.ID
LEFT JOIN users_info AS ii ON i.Inviter = ii.UserID
2013-03-15 08:00:47 +00:00
WHERE";
2013-05-02 08:00:23 +00:00
if ($DateSearch) {
2013-03-15 08:00:47 +00:00
$RS .= " i.JoinDate BETWEEN '$AfterDate' AND '$BeforeDate' ";
} else {
2013-05-02 08:00:23 +00:00
$RS .= " i.JoinDate > '".time_minus(3600 * 24 * 3)."'";
2013-03-15 08:00:47 +00:00
}
2013-03-18 08:00:24 +00:00
$RS .= " ORDER BY i.Joindate DESC LIMIT $Limit";
2013-03-15 08:00:47 +00:00
$QueryID = $DB->query($RS);
2011-03-28 14:21:28 +00:00
$DB->query("SELECT FOUND_ROWS()");
list($Results) = $DB->next_record();
2013-03-15 08:00:47 +00:00
$DB->set_query_id($QueryID);
?>
<form action="" method="post" acclass="thin box pad">
2013-03-25 08:00:21 +00:00
<input type="hidden" name="action" value="registration_log" />
Joined after: <input type="date" name="after_date" />
Joined before: <input type="date" name="before_date" />
<input type="submit" />
2013-03-15 08:00:47 +00:00
</form>
2011-03-28 14:21:28 +00:00
2013-03-15 08:00:47 +00:00
<?
2013-03-25 08:00:21 +00:00
if ($DB->record_count()) {
2011-03-28 14:21:28 +00:00
?>
<div class="linkbox">
<?
2013-05-02 08:00:23 +00:00
$Pages = Format::get_pages($Page,$Results,USERS_PER_PAGE,11) ;
2011-03-28 14:21:28 +00:00
echo $Pages;
?>
</div>
2013-03-15 08:00:47 +00:00
2011-03-28 14:21:28 +00:00
<table width="100%">
<tr class="colhead">
<td>User</td>
<td>Ratio</td>
<td>Email</td>
2013-02-09 08:01:01 +00:00
<td>IP address</td>
2012-08-03 08:00:17 +00:00
<td>Country</td>
2011-03-28 14:21:28 +00:00
<td>Host</td>
<td>Registered</td>
</tr>
<?
2013-05-02 08:00:23 +00:00
while (list($UserID, $IP, $IPCC, $Email, $Username, $PermissionID, $Uploaded, $Downloaded, $Enabled, $Donor, $Warned, $Joined, $Uses, $InviterID, $InviterIP, $InviterIPCC, $InviterEmail, $InviterUsername, $InviterPermissionID, $InviterUploaded, $InviterDownloaded, $InviterEnabled, $InviterDonor, $InviterWarned, $InviterJoined, $InviterUses) = $DB->next_record()) {
2011-03-28 14:21:28 +00:00
$Row = ($IP == $InviterIP) ? 'a' : 'b';
?>
<tr class="row<?=$Row?>">
2012-10-11 08:00:15 +00:00
<td><?=Users::format_username($UserID, true, true, true, true)?><br /><?=Users::format_username($InviterID, true, true, true, true)?></td>
<td><?=Format::get_ratio_html($Uploaded,$Downloaded)?><br /><?=Format::get_ratio_html($InviterUploaded,$InviterDownloaded)?></td>
2011-03-28 14:21:28 +00:00
<td>
2013-03-25 08:00:21 +00:00
<span style="float: left;"><?=display_str($Email)?></span>
<span style="float: right;"><a href="userhistory.php?action=email&amp;userid=<?=$UserID?>" title="History" class="brackets">H</a> <a href="/user.php?action=search&amp;email_history=on&amp;email=<?=display_str($Email)?>" title="Search" class="brackets">S</a></span><br />
<span style="float: left;"><?=display_str($InviterEmail)?></span>
<span style="float: right;"><a href="userhistory.php?action=email&amp;userid=<?=$InviterID?>" title="History" class="brackets">H</a> <a href="/user.php?action=search&amp;email_history=on&amp;email=<?=display_str($InviterEmail)?>" title="Search" class="brackets">S</a></span><br />
2011-03-28 14:21:28 +00:00
</td>
<td>
2013-03-25 08:00:21 +00:00
<span style="float: left;"><?=display_str($IP)?></span>
2013-05-04 08:00:48 +00:00
<span style="float: right;"><?=display_str($Uses)?> <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> <a href="http://whatismyipaddress.com/ip/<?=display_str($IP)?>" title="WI" class="brackets">WI</a></span><br />
2013-03-25 08:00:21 +00:00
<span style="float: left;"><?=display_str($InviterIP)?></span>
2013-05-04 08:00:48 +00:00
<span style="float: right;"><?=display_str($InviterUses)?> <a href="userhistory.php?action=ips&amp;userid=<?=$InviterID?>" title="History" class="brackets">H</a> <a href="/user.php?action=search&amp;ip_history=on&amp;ip=<?=display_str($InviterIP)?>" title="Search" class="brackets">S</a> <a href="http://whatismyipaddress.com/ip/<?=display_str($InviterIP)?>" title="WI" class="brackets">WI</a></span><br />
2011-03-28 14:21:28 +00:00
</td>
2012-08-03 08:00:17 +00:00
<td>
<?=$IPCC?> <br />
<?=$InviterIPCC?>
</td>
2011-03-28 14:21:28 +00:00
<td>
2012-10-11 08:00:15 +00:00
<?=Tools::get_host_by_ajax($IP)?><br />
<?=Tools::get_host_by_ajax($InviterIP)?>
2011-03-28 14:21:28 +00:00
</td>
2013-05-02 08:00:23 +00:00
<td>
<?=time_diff($Joined)?><br />
<?=time_diff($InviterJoined)?>
</td>
2011-03-28 14:21:28 +00:00
</tr>
<? } ?>
</table>
<div class="linkbox">
<? echo $Pages; ?>
</div>
2013-05-02 08:00:23 +00:00
<?
} else { ?>
2011-03-28 14:21:28 +00:00
<h2 align="center">There have been no new registrations in the past 72 hours.</h2>
2013-05-02 08:00:23 +00:00
<?
}
2012-10-11 08:00:15 +00:00
View::show_footer();
2011-03-28 14:21:28 +00:00
?>