Thread: Deny double IP
View Single Post
  #2  
Old 22nd July 2018, 09:52
nilim's Avatar
nilim nilim is offline
Senior Member
 
Join Date: Apr 2016
P2P
Posts: 52
Default
For Detecting duplicate ip during sign up
In account-signup.php

Code:
        // check if IP is already in use
        $a = (@mysql_fetch_row(@SQL_Query_exec("select count(*) from users where ip='$ip'")));
        if ($a[0] != 0)
         $message = sprintf(T_("IP_ADDRESS_INUSE_S"), $ip);

For detecting duplicate ip already in use
In admincp.php

add
Code:
<td align="center"><a href="admincp.php?action=duplicateips"><img src="images/admin/double-ip.png" border="0" width="118" height="80" alt="" /><br /><?php echo T_("DUPLICATEIP"); ?><br /></a></td>
also add

Code:
#======================================================================#
#  Duplicate IP's
#======================================================================#
if ($action == "duplicateips")
{
        $res = SQL_Query_exec("SELECT ip FROM users GROUP BY ip HAVING count(*) > 1");
        $num = mysql_num_rows($res);
        
        list($pagertop, $pagerbottom, $limit) = pager(25, $num, 'admincp.php?action=duplicateips&amp;');
        
        $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"));
        
        
        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 = mysql_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();
      navmenu();
        stdfoot();
}
add this in language

Code:
$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.";
put image in images folder.
Attached Images
 

Last edited by nilim; 22nd July 2018 at 11:14.
Reply With Quote