#native_company# #native_desc#

Redirect and Block surfers by Country or Anonymous Proxy

By Adam
on March 14, 2004

Version: 1.0

Type: Full Script

Category: HTTP

License: GNU General Public License

Description: This code allows webmasters to take control of surfers to their sites. By redirecting clients according to what country they come from or whether or not the surfer is using an anonymous proxy, webmasters are able to provide customised content directly to their audience.

To use the code you will need to change 4 variables:
1. Add the page that you want allowed users to be redirected to;
2. Add the page that you want blocked users to be redirected to;
3. Add your Country Check (www.countrycheck.com) user number;
4. Add your Country Check password;
5. Save the file as "index.php" and ftp it. Make sure to rename your original index file to avoid overwriting it. 



$fp = @fsockopen("countrycheck.com", 80, $errno, $errstr, 10);
   	$result = '';
	@fputs($fp,"GET http://www.countrycheck.com/ip.aspx?u=USERNUMBER&p=PASSWORD&t=1&ip=$ip HTTP/1.0rnHost: $_SERVER[HTTP_HOST]rnrn");
	@socket_set_timeout($fp, 10);
    while([email protected]($fp))
      	$result .= @fgets($fp, 1024);

if(strpos($result, 'NO') === false) {
header("Location: $ok");
else {
header("Location: $not");