To prevent unwanted visitor and spam mail i used to use ip files to block. i have been applying this code in the begin of the header file (static website) from years, is still work but while submitting on google search engine for SEO, index request is reject with soft 404 error.
Ip filter code:
$IPaddress=$_SERVER['REMOTE_ADDR'];
$two_letter_country_code=iptocountry($IPaddress);
include("ip_files/countries.php");
$three_letter_country_code=$countries[ $two_letter_country_code][0];
$country_name=$countries[$two_letter_country_code][1];
function iptocountry($ip) {
$numbers = preg_split( "/\./", $ip);
include("ip_files/".$numbers[0].".php");
$code=($numbers[0] * 16777216) + ($numbers[1] * 65536) + ($numbers[2] * 256) + ($numbers[3]);
foreach($ranges as $key => $value){
if($key<=$code){
if($ranges[$key][0]>=$code){$two_letter_country_code=$ranges[$key][1];break;}
}
}
if ($two_letter_country_code==""){$two_letter_country_code="unkown";}
return $two_letter_country_code;
}
if ($two_letter_country_code=="PK" || $two_letter_country_code=="RU" || $two_letter_country_code=="IN")
die("Something Went Wrong. Please Contact Your HOstinG");
$country_codes_to_block = array('PK', 'RU', 'IN');
if i remove above code there is no error on submission on google search engine. i have face this error from few days only previous it was working fine even last week it was fine.
can anyone suggest the solutions