<?php
//----------------------------------------------------------------------------------------------
//USER IP
function getUserIP() {
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
return $_SERVER['HTTP_CLIENT_IP'];
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
return $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
return $_SERVER['REMOTE_ADDR'];
}
}
$userIP = getUserIP();
function getCountryFromIP($ip) {
$api_url = "http://ip-api.com/json/{$ip}";
$json_data = file_get_contents($api_url);
$location_data = json_decode($json_data, true);
return $location_data['country'];
}
$userCountry = getCountryFromIP($userIP);
// List of countries for which content should be hidden
$hidden_countries = array('Pakistan', 'Sweden'); // Add more countries as needed
if (in_array($userCountry, $hidden_countries)) {
echo '';
} else {
//----------------------------------------------------------------------------------------------
echo'
'.$hidden_countries.'
<script type="text/javascript">
atOptions = {
\'key\' : \'a8c68ea9550786bc6980fd2a090cc17e\',
\'format\' : \'iframe\',
\'height\' : 600,
\'width\' : 160,
\'params\' : {}
};
document.write(\'<scr\' + \'ipt type="text/javascript" src="http\' + (location.protocol === \'https:\' ? \'s\' : \'\') + \'://www.profitabledisplaynetwork.com/a8c68ea9550786bc6980fd2a090cc17e/invoke.js"></scr\' + \'ipt>\');
</script>';
//-------------------------------------------------------------------------------------------------
}
//-------------------------------------------------------------------------------------------------
?>
ConversionConversion EmoticonEmoticon