Question : Applying Personal Settings

Client PC's are taking ages to load into the domain name server giving a message "applying personal settings"

This appears to have happened only after we had issues with the DNS on a previous question that was resolved.

Answer : Applying Personal Settings

This won't give you all the IPs of a country but it will tell you the country of the current browser, with which you can decide to do or not do some code.

In this example I send all United States visitors to www.example.com (which actually exists,) and away from my site.

You could send them to a forbidden.php page on your site, set a cookie and check for that cookie on all your pages to decide if you are going to allow access or even show different content.

I currently send all traffic from two countries to a CAPTCHA page because 99% of the visits from those countries are bots. The bots can't solve the CAPTCHA so they time out and go some place else.

Regards,
Rod

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
<?php
$iaRemoteIP = $_SERVER['REMOTE_ADDR'];

$d = file_get_contents("http://www.ipinfodb.com/ip_query.php?ip=$iaRemoteIP&output=xml");
 
//Use backup server if cannot make a connection
if (!$d){
	$backup = file_get_contents("http://backup.ipinfodb.com/ip_query.php?ip=$ip&output=xml");
	$answer = new SimpleXMLElement($backup);
	if (!$backup) return false; // Failed to open connection
}else{
	$answer = new SimpleXMLElement($d);
}
 
$iaCountry = $answer->CountryName;

If ($iaCountry=="United States") {
    header("Location: http://www.example.com");
}
?>
Random Solutions  
 
programming4us programming4us