I have several web sites hosted on a shared server. They all have forms to fill out and all have IP address trapping. I get a lot of auto form fillers so added the following code
// Banned IP addresses
if (file_exists(“blockedIPs.txt”))
{
$ip = $_SERVER[‘REMOTE_ADDR’];
$fp = fopen("…/blockedIPs.txt",“r”);
$banned = fread($fp, 1024*1024);
fclose($fp);
$ips = explode("\n", $banned);
foreach ($ips as $value) {
if($ip == trim($value)){
die(“Sorry your IP is banned!”);
}
}
}
The problem is I want to have just one blockedIPs.txt located in the root directory so that all the web sites can access it and I only have to update 1 txt file and not multiple ones. I can’t seem to get this to work so any help would be appreciated.
Paul