Skip to content

Instantly share code, notes, and snippets.

@benoitjpnet
Created September 3, 2013 19:12
Show Gist options
  • Save benoitjpnet/6428258 to your computer and use it in GitHub Desktop.
Save benoitjpnet/6428258 to your computer and use it in GitHub Desktop.
<?php
/* Geolocalization part. */
$bannedCountry = array();
$bannedCountry['Love Lab'] = array('FR', 'BE'); // BE pour tester ;)
$visitorCountry = geoip_country_code_by_name($_SERVER['REMOTE_ADDR']);
$post = get_post();
$postTitle = $post->post_title;
foreach($bannedCountry as $animeTitle => $bannedCountryCode) {
if($animeTitle == $postTitle) {
if (in_array($visitorCountry, $bannedCountryCode) === TRUE) {
//header('Location: http://mo-f.fr/contenu-licencie/');
echo '<h1> Pays bloqué ! (test beta ;)) </h1>';
die(1);
}
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment