Gazelle/sections/tools/data/common_snatches.php

71 lines
1.5 KiB
PHP
Raw Normal View History

2012-08-22 08:00:18 +00:00
<?php
if (!check_perms('users_mod')) { error(403);
}
2012-10-11 08:00:15 +00:00
View::show_header('Common Snatches');
2012-08-22 08:00:18 +00:00
?>
<div class="header">
<h2>Common Snatches</h2>
</div>
<table width="100%">
<tr class="colhead">
<td>User A</td>
<td>User B</td>
<td>Limit</td>
</tr>
<tr/>
<tr>
2012-09-15 08:00:25 +00:00
<form class="manage_form" name="common_snatches" method="post">
2012-08-22 08:00:18 +00:00
<input type="hidden" name="compare" value="1" />
<td>
2012-09-19 08:00:35 +00:00
<input type="text" name="userida" />
2012-08-22 08:00:18 +00:00
</td>
<td>
2012-09-19 08:00:35 +00:00
<input type="text" name="useridb" />
2012-08-22 08:00:18 +00:00
</td>
<td>
2012-09-19 08:00:35 +00:00
<input type="text" name="limit" value="50" />
2012-08-22 08:00:18 +00:00
</td>
<td>
2012-09-19 08:00:35 +00:00
<input type="submit" value="Compare" />
2012-08-22 08:00:18 +00:00
</td>
</form>
</tr>
</table>
<?
if(isset($_POST['compare'])) {
if (isset($_POST['userida']) && is_numeric($_POST['userida']) && isset($_POST['useridb']) && is_numeric($_POST['useridb'])) {
$UserIDA = (int) $_POST['userida'];
$UserIDB = (int) $_POST['useridb'];
if(isset($_POST['limit']) && is_numeric($_POST['limit'])) {
$Limit = 'LIMIT ' . $_POST['limit'];
}
$DB->query("SELECT g.ID, g.Name FROM torrents AS t INNER JOIN torrents_group AS g ON g.ID = t.GroupID JOIN xbt_snatched AS xs ON xs.fid=t.ID WHERE xs.uid IN ($UserIDA,$UserIDB) HAVING COUNT(xs.fid) > 1 ORDER BY xs.tstamp DESC $LIMIT");
?>
<table width="80%">
<tr class="colhead">
<td>Torrent</td>
</tr>
<tr/>
<?
while(list($GroupID, $GroupName) = $DB->next_record()) {
?>
<tr>
<td>
<a href="torrents.php?id=<?=$GroupID?>"><?=$GroupName?></a>
</td>
</tr>
<?
}
?>
</table>
<?
}
}
2012-10-11 08:00:15 +00:00
View::show_footer();
2012-09-19 08:00:35 +00:00
?>