Created
September 24, 2016 13:28
-
-
Save microdesign/94f20b4d50e4a69fbee8233df92e35c3 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<?php | |
$ip = $_SERVER['REMOTE_ADDR']; | |
$code = file_get_contents('https://ipapi.co/'.$ip.'/country/'); | |
$bannedCountries = ['IT', 'AU', 'MY', 'HK']; //Replace with your countries | |
if (in_array($code, $bannedCountries)) { | |
die('No access'); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment