Skip to content

Instantly share code, notes, and snippets.

@tgxn
Created August 20, 2015 06:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tgxn/c2fd177eda29e47ab409 to your computer and use it in GitHub Desktop.
Save tgxn/c2fd177eda29e47ab409 to your computer and use it in GitHub Desktop.
Whitelist Sites with CF Header
$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