Created
August 20, 2015 06:22
-
-
Save tgxn/c2fd177eda29e47ab409 to your computer and use it in GitHub Desktop.
Whitelist Sites with CF Header
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$whitelistCountries = array( | |
"NZ" | |
); | |
if(isset($_SERVER["HTTP_CF_IPCOUNTRY"])) { | |
$block = true; | |
for($whitelistCountries as $country) { | |
if($_SERVER["HTTP_CF_IPCOUNTRY"] == $country) { | |
$block = false; | |
} | |
} | |
if($block) { | |
die('Country Disallowed'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment