- Blocked: 192.168.1.100 -> IPblock:192.*.*.*
- Blocked: 192.168.1.100 -> IPblock:192.168.*.*
- Blocked: 192.168.1.100 -> IPblock:192.168.1.*
- Blocked: 192.168.1.100 -> IPblock:192.168.1.100
- Blocked: 192.168.1.100 -> IPblock:*.*.*.*
- <?php
- $IP[] = '192.*.*.*';
- $IP[] = '192.168.*.*';
- $IP[] = '192.168.1.*';
- $IP[] = '192.168.1.100';
- $IP[] = '*.*.*.*';
- $IPadres = $_SERVER['REMOTE_ADDR'];
- foreach( $IP as $pointer => $blip) {
- $pattern = str_replace('.','\.',$blip);
- $pattern = str_replace('*','(.*)',$pattern);
- if ( ereg($pattern, $IPadres)) {
- //Your error message
- die('Banned o.O');
- } else {
- // Your normal content
- }
- }
- ?>
This is quite dangerous. You can block your own access if you set it worng. Not to mention the whole world .
It's rather simple. And IP is in the order of xxx.xxx.xxx.xxx
with dynamic IP the last xxx do change most of the time. So you could set a range block on those.
You'll add an the ip like 127.014.154.* . It will block all ip that are in the area of 127.014.154.0-255. At least it should.