Posted in blocking
171
7:50 am, June 25, 2025
 

blocking all ips in a range

block all ips in a range

// The IP prefixes you want to block. Add a dot at the end.
$ip_block = ['47.79.'];

foreach ($ip_block as $ip_block_val) {
  // Check if the user's IP address begins with the blocked prefix.
  // strpos() will return 0 if it's found at the beginning of the string.
  if (strpos($_SERVER['REMOTE_ADDR'], $ip_block_val) === 0) {
    echo "Your IP range has been blocked.";
    return false;
  }
}

 

PHP

// The IP prefixes you want to block. Add a dot at the end.
$ip_block = ['47.79.'];

foreach ($ip_block as $ip_block_val) {
  // Check if the user's IP address begins with the blocked prefix.
  // strpos() will return 0 if it's found at the beginning of the string.
  if (strpos($_SERVER['REMOTE_ADDR'], $ip_block_val) === 0) {
    echo "Your IP range has been blocked.";
    return false;
  }
}

View Statistics
This Week
11
This Month
11
This Year
260

No Items Found.

Add Comment
Type in a Nick Name here
 
Other Items in blocking
Search Code
Search Code by entering your search text above.
Welcome

This is my test area for webdev. I keep a collection of code here, mostly for my reference. Also if i find a good link, i usually add it here and then forget about it. more...

You could also follow me on twitter. I have a couple of youtube channels if you want to see some video related content. RuneScape 3, Minecraft and also a coding channel here Web Dev.

If you found something useful or like my work, you can buy me a coffee here. Mmm Coffee. ☕

❤️👩‍💻🎮

🪦 2000 - 16 Oct 2022 - Boots
Random Quote
The mind must be given relaxation; it will arise better and keener after resting. As rich fields must not be forced-for their productiveness, the have no rest, will quickly exhaust them constantlabor will break the vigor of the mind, but if it is released and relaxed a little while, it will recover its powers
Seneca
Random CSS Property

negative

When defining custom counter styles, the negative descriptor lets you alter the representations of negative counter values, by providing a way to specify symbols to be appended or prepended to the counter representation when the value is negative.
negative (@counter-style) css reference