Gazelle/sections/userhistory/ip_tracker_history.php

100 lines
2.2 KiB
PHP
Raw Normal View History

2013-05-28 08:01:02 +00:00
<?php
2011-03-28 14:21:28 +00:00
/************************************************************************
||------------|| User IP history page ||---------------------------||
This page lists previous IPs a user has connected to the site with. It
gets called if $_GET['action'] == 'ips'.
It also requires $_GET['userid'] in order to get the data for the correct
user.
************************************************************************/
define('IPS_PER_PAGE', 25);
2013-05-01 08:00:16 +00:00
if (!check_perms('users_mod')) {
error(403);
}
2011-03-28 14:21:28 +00:00
$UserID = $_GET['userid'];
2013-05-01 08:00:16 +00:00
if (!is_number($UserID)) {
error(404);
}
2011-03-28 14:21:28 +00:00
2013-05-01 08:00:16 +00:00
$DB->query("
SELECT um.Username,
p.Level AS Class
FROM users_main AS um
2013-07-04 08:00:56 +00:00
LEFT JOIN permissions AS p ON p.ID = um.PermissionID
WHERE um.ID = $UserID");
list($Username, $Class) = $DB->next_record();
2013-05-01 08:00:16 +00:00
if (!check_perms('users_view_ips', $Class)) {
error(403);
}
$UsersOnly = $_GET['usersonly'];
2011-03-28 14:21:28 +00:00
2013-07-04 08:00:56 +00:00
View::show_header("Tracker IP address history for $Username");
2011-03-28 14:21:28 +00:00
?>
<script type="text/javascript">
function ShowIPs(rowname) {
2013-06-17 08:01:02 +00:00
$('tr[name="'+rowname+'"]').gtoggle();
2011-03-28 14:21:28 +00:00
}
</script>
<?
2013-05-28 08:01:02 +00:00
list($Page, $Limit) = Format::page_limit(IPS_PER_PAGE);
2011-03-28 14:21:28 +00:00
2013-05-15 08:00:54 +00:00
$TrackerIps = $DB->query("
SELECT IP, fid, tstamp
FROM xbt_snatched
WHERE uid = $UserID
AND IP != ''
ORDER BY tstamp DESC
LIMIT $Limit");
2011-03-28 14:21:28 +00:00
2013-07-04 08:00:56 +00:00
$DB->query('SELECT FOUND_ROWS()');
2011-03-28 14:21:28 +00:00
list($NumResults) = $DB->next_record();
$DB->set_query_id($TrackerIps);
2013-05-15 08:00:54 +00:00
$Pages = Format::get_pages($Page, $NumResults, IPS_PER_PAGE, 9);
2011-03-28 14:21:28 +00:00
?>
2012-08-19 08:00:19 +00:00
<div class="thin">
<div class="header">
2013-05-15 08:00:54 +00:00
<h2>Tracker IP address history for <a href="user.php?id=<?=$UserID?>"><?=$Username?></a></h2>
2012-08-19 08:00:19 +00:00
</div>
2011-03-28 14:21:28 +00:00
<div class="linkbox"><?=$Pages?></div>
<table>
<tr class="colhead">
<td>IP address</td>
<td>Torrent</td>
<td>Time</td>
</tr>
<?
$Results = $DB->to_array();
2013-05-01 08:00:16 +00:00
foreach ($Results as $Index => $Result) {
2011-03-28 14:21:28 +00:00
list($IP, $TorrentID, $Time) = $Result;
?>
<tr class="rowa">
2013-02-09 08:01:01 +00:00
<td>
<?=$IP?> (<?=Tools::get_country_code_by_ajax($IP)?>)<br /><?=Tools::get_host_by_ajax($IP)?>
<a href="http://whatismyipaddress.com/ip/<?=display_str($IP)?>" class="brackets" title="Search WIMIA.com">WI</a>
</td>
2011-03-28 14:21:28 +00:00
<td><a href="torrents.php?torrentid=<?=$TorrentID?>"><?=$TorrentID?></a></td>
2013-05-01 08:00:16 +00:00
<td><?=date('Y-m-d g:i:s', $Time)?></td>
2011-03-28 14:21:28 +00:00
</tr>
<?
}
?>
</table>
<div class="linkbox">
<?=$Pages?>
</div>
</div>
<?
2012-10-11 08:00:15 +00:00
View::show_footer();
2011-03-28 14:21:28 +00:00
?>