1

Topic: How to block multiple IP adresses

// Denied IP's.
    $deny_ips = array(
        '127.0.0.1',
        '192.168.100.1',
        '192.168.200.1',
        '192.168.300.1',
        'xxx.xxx.xxx.xxx'
    );
 
    // $deny_ips = file('blocked_ips.txt');
 
    // read user ip adress:
    $ip = isset($_SERVER['REMOTE_ADDR']) ? trim($_SERVER['REMOTE_ADDR']) : '';
 
    // search current IP in $deny_ips array
    if (($i = array_search($ip, $deny_ips)) !== FALSE){
 
        // $i = contains the array key of the IP adress.        
 
        // user is blocked:
        print "Your IP adress ('$ip') was blocked!";
        exit;
    }
 
    // If we reach this section, the IP adress is valid

Warning: Undefined variable $pattern_callback in /var/www/vhosts/ctw/include/parser.php on line 820

Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in /var/www/vhosts/ctw/include/parser.php:820 Stack trace: #0 /var/www/vhosts/ctw/include/parser.php(1037): do_bbcode() #1 /var/www/vhosts/ctw/viewtopic.php(532): parse_signature() #2 {main} thrown in /var/www/vhosts/ctw/include/parser.php on line 820