
March 14th, 2004, 11:23 AM
|
|
Registered User
|
|
Join Date: Apr 2007
Posts: 22,309
Time spent in forums: < 1 sec
Reputation Power: 24
|
|
|
PHP Code - Redirect and Block Country or Anonymous Surfers
This code allows webmasters to redirect surfers by country or anonymous IP. Set up your block list at Country Check (www.countrycheck.com) and then change 4 variables in the code:
1. The site you want allowed visitors access to;
2. The site url for not allowed visitors;
3. Your Country Check usernumber;
4. Your Country Check password.
5. Rename the page "index.php" and ftp. Make sure you have changed your original "index" filename to something else first.
php Code:
Original
- php Code |
|
|
|
<?php $ok='http://www.YOURSITE.com/ALLOWEDPAGE'; $not='http://www.YOURSITE.com/NOTALLOWEDPAGE'; $ip=$_SERVER['REMOTE_ADDR']; $fp = @ fsockopen("countrycheck.com", 80, $errno, $errstr, 10); if(!$fp) {} else { $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"); { $result .= @ fgets($fp, 1024); } } if(strpos($result, 'NO') === false) { } else { } ?>
|