Login
Username: Password:
Remember me

[Sign Up] / [Recover Password]

Theme / Language

Popular
New Torrents
new name
Size: 18.40 MB
Most active
new name
S: 74 L: 3
New Posters
Duplicate IPs' [TTv3]
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / Torrent Trader / v3 Mods Completed

2019-04-14 22:35:57
Find if multiple accounts are using the same IP address. Credit to original authors
add to admincp.php

#======================================================================#
#  Duplicate IP's
#======================================================================#
if ($action == "duplicateips")
{
       $res = SQL_Query_exec("SELECT ip FROM users GROUP BY ip HAVING count(*) > 1");
       $num = mysqli_num_rows($res);
     
       list($pagertop, $pagerbottom, $limit) = pager(25, $num, 'admincp.php?action=duplicateips&');
     
       $res = SQL_Query_exec("SELECT id, username, class, email, ip, added, last_access, COUNT(*) as count FROM users GROUP BY ip HAVING count(*) > 1 ORDER BY id ASC $limit");

       stdhead(T_("DUPLICATEIP"));
       navmenu();
       begin_frame(T_("DUPLICATEIP"));
       ?>
     
       <center><?php echo T_("DUPLICATEIPINFO"); ?></center>

       <br />
     
       <?php if ($num > 0): ?>
       <br />
       <table border="0" cellpadding="3" cellspacing="0" width="100%" align="center" class="table_table">
       <tr>
                       <th class="table_head"><?php echo T_("USERNAME"); ?></th>
                       <th class="table_head"><?php echo T_("USERCLASS"); ?></th>
                       <th class="table_head"><?php echo T_("EMAIL"); ?></th>
                       <th class="table_head"><?php echo T_("IP"); ?></th>
                       <th class="table_head"><?php echo T_("ADDED"); ?></th>
                       <th class="table_head"><?php echo T_("COUNT"); ?></th>
       </tr>
       <?php while ($row = mysqli_fetch_assoc($res)): ?>
       <tr>
                       <td class="table_col1" align="center"><a href="account-details.php?id=<?php echo $row["id"]; ?>"><?php echo $row["username"]; ?></a></td>
                       <td class="table_col2" align="center"><?php echo get_user_class_name($row["class"]); ?></td>
                       <td class="table_col1" align="center"><?php echo $row["email"]; ?></td>
                       <td class="table_col2" align="center"><?php echo $row["ip"]; ?></td>
                       <td class="table_col1" align="center"><?php echo utc_to_tz($row["added"]); ?></td>
                       <td class="table_col1" align="center"><a href="admincp.php?action=usersearch&amp;ip=<?php echo $row['ip']; ?>"><?php echo number_format($row['count']); ?></a></td>
       </tr>
       <?php endwhile; ?>
       </table>                
       <?php else: ?>
                  <center><b><?php echo T_("NOTHING_FOUND"); ?></b></center>
       <?php
       endif;
                                                                                                               
       if ($num > 25) echo $pagerbottom;

       end_frame();
       stdfoot();
}
#======================================================================#
#       End Duplicate IP Mod
#======================================================================#


create a link to the mod near the top of admincp.php file
<td align="center"><a href="admincp.php?action=duplicateips"><img src="images/admin/double-ip.ico" border="0" width="118" height="80" alt="" /><br /><?php echo T_("DUPLICATEIP"); ?><br /></a></td> 


add to languages/english.php
$LANG['DUPLICATEIP'] = 'Duplicate IP\'s';
$LANG['DUPLICATEIPINFO'] = "This page displays all users which the database shows them having more than one account associated by their ip.";


add to images/admin folder. I had to rar it because it is an ICO icon
double-ip.rar
Download

TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
2019-04-15 14:47:33
The first bracket of the code should be removed
2019-04-15 22:07:04
oops. My bad. Fixed
TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
2023-08-03 20:38:35
Big thanks !  👍
2023-08-06 17:09:21
Often with COUNT(x) it will limit the result set, maybe this is why there is grouping taking place, but its best to use a sub query for these things

SELECT (SELECT COUNT(id) FROM users WHERE ip = u.ip LIMIT 1) as count FROM users u ...

Also, be sure to do COUNT() on a primary key (index) so its fast. Otherwise, using the asterisk character on a large user table will be inefficient since it is pulling all columns regardless of needing say.. 2 or 3 in the result set.

The same applies for torrent table. Make lookups/counts fast as much as possible.
Last edited by STorrents2020 on 2023-08-06 17:12:53
Users online

No users online

Search



Statistics

    Torrents

  • Tracking: 3
  • Todays torrents: 0
  • Seeders: 0
  • Leechers: 0
  • Peers: 0
  • Downloaded: 89.96 GB
  • Uploaded: 9.86 GB

  • Members

  • We have: 838
  • New today: 0
  • Guest today: 9

  • Online

  • Total online: 2
  • Members: 0
  • Guests online: 2
  • Comments: 3
  • Messages: 1,728