Plugin Directory

Changeset 3057573


Ignore:
Timestamp:
03/24/2024 08:28:35 AM (12 months ago)
Author:
dynahsty
Message:

v1.23.2

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ip-guard/trunk/ip-guard.php

    r3053313 r3057573  
    33Plugin Name: IPGuard
    44Description: A robust security plugin that empowers administrators to safeguard user accounts by implementing IP address-based lockdowns.
    5 Version: 1.23.1
     5Version: 1.23.2
    66Author: <a href="https://wa.link/kemj38">Dynasty</a>
    77Contributors: Dynahsty
     
    1111Tested up to: 6.4.3
    1212Requires PHP: 7.4
    13 Stable tag: 1.23.1
     13Stable tag: 1.23.2
    1414License: GPLv2 or later
    1515License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    3333
    3434        if ($client_ip && filter_var($client_ip, FILTER_VALIDATE_IP)) {
    35             if (!in_array($client_ip, $stored_ips)) {
     35            $first_octet = explode('.', $client_ip)[0];
     36            $similar_ip_exists = false;
     37            foreach ($stored_ips as $stored_ip) {
     38                if (strpos($stored_ip, $first_octet . '.') === 0) {
     39                    $similar_ip_exists = true;
     40                    break;
     41                }
     42            }
     43
     44            if (!$similar_ip_exists) {
    3645                $stored_ips[] = $client_ip;
    3746                update_user_meta($user->ID, '_stored_ips', $stored_ips);
     
    5463    return $user;
    5564}
     65
    5666
    5767function ip_addresses_similar($ip_addresses) {
Note: See TracChangeset for help on using the changeset viewer.