Jump to content
[MUST READ] Forum Rules ×

How to limit access of users from Russia, Crimea and Belarus


Recommended Posts

10 hours ago, Ultimate Host said:

Hello, with the recent news I was thinking - how I can limit access users from Russia, Crimea and Belarus without Cloudflare?

ok.

<?
function ipddr() {
      
    if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
        return $_SERVER['HTTP_CLIENT_IP'];
    }
    else if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
        return $_SERVER['HTTP_X_FORWARDED_FOR'];
    }
    else {
        return $_SERVER['REMOTE_ADDR'];
    }
}
$ip = ipddr();
$ipinfo = @json_decode(file_get_contents(
    "https://www.geoplugin.net/json.gp?ip=" . $ip));
$cc = $ipinfo->geoplugin_countryCode;
if($cc == "TW") { // Replace TW to Country You Want To Block (Country Code)
    echo "aaa"; 
}

 

Edited by MeTooIDK
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...