If you have measured some suspected IP address don't worry you can restrict those IP addresses in PHP. Those IP will not be able to access you website.
Here I have created a text file where all the block ips has been written. And I also have created blocked IPs array. I will get the client IP and then will check the blocked list of IPs if user IP exist in the blocked IPs array then will show the message on website.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
<?php if ( !file_exists('blocked_ips.txt') ) { $blockIPS = array( '127.0.0.1', '192.168.21.100', '85.78.17.90', '192.168.1.176' ); } else { $blockIPS = file('blocked_ips.txt'); } // you also can get blocked ip array from your database // read user ip adress: $ip = isset($_SERVER['REMOTE_ADDR']) ? trim($_SERVER['REMOTE_ADDR']) : ''; // search current IP in $blockIPS array if ( (in_array($ip, $blockIPS))!== FALSE ) { echo 'Your IP adress ('.$ip.') was blocked!'; exit; } ?> |