Hi
This php code try to read Ips from blacklist.txt file and then restrict access to page from visitors with same IP in blacklist.txt
[CODE]<?php
if ( !file_exists(‘blacklist.txt’) ) {
$deny_ips = array(
‘127.0.0.1’,
‘192.168.1.1’,
‘83.76.27.9’,
‘192.168.1.163’
);
} else {
$deny_ips = file(‘blacklist.txt’);
}
// read user ip adress:
$ip = isset($_SERVER[‘REMOTE_ADDR’]) ? trim($_SERVER[‘REMOTE_ADDR’]) : ”;
// search current IP in $deny_ips array
if ( (array_search($ip, $deny_ips))!== FALSE ) {
// address is blocked:
echo ‘Your IP adress (‘.$ip.’) was blocked!’;
exit;
}
?>
But
-This code can’t read blacklist.txt if it has been tons thousands IP listed , how can fix it and make it available to read big list
and
– How can i make script to read Ips from an external URL for get low load in CPU . for example blacklist be on another server and address :[url]http://domain2.com/blacklist.txt