Skip to content

Instantly share code, notes, and snippets.

@tgxn tgxn/whitelist.php
Created Aug 20, 2015

Embed
What would you like to do?
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
You can’t perform that action at this time.