Post by richard211986 » Mon Dec 07, 2009 12:42 am

im looking for someone to help me with blocking specific ip's/countries from viewing my domain due to fraudsters originating from these countries/ip's

ive read this can be done via .htaccess?

Active Member

Posts

Joined
Sun Sep 20, 2009 5:34 am

Post by Qphoria » Mon Dec 07, 2009 2:15 am

Yes. it can. Google htaccess "deny"

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by richard211986 » Mon Dec 07, 2009 4:13 am

ive google that and made a .htaccess.txt file within this is the range of ips i want to block

ErrorDocument 403 http://www.blockacountry.com/blocked.php
<Limit GET HEAD POST>
order allow,deny
deny from 62.5.128.0/17
deny from 217.198.160.0/20
deny from 217.198.176.0/20
deny from 217.199.208.0/20
deny from 217.199.240.0/20
allow from all
</LIMIT>

ive uploaded the .htaccess.txt file to the root of my domain and have removed the .txt part from the file name so its now .htaccess.

is this all correct?

Active Member

Posts

Joined
Sun Sep 20, 2009 5:34 am

Post by dannowatts » Mon Dec 07, 2009 12:20 pm

yep, should be good.
now just ask a scammer to kindly try and visit your site and you should be set! :P

rocksteady,
danno~

New member

Posts

Joined
Tue Nov 10, 2009 11:40 am

Post by richard211986 » Tue Dec 08, 2009 2:12 am

yeh hahahaha ive blocked the whole country from where i was recieving paypal fraudsters buy products from me so hopefully this works.....i wish their was a way to actually test it though to make sure.

Active Member

Posts

Joined
Sun Sep 20, 2009 5:34 am

Post by rockprincess » Tue Jan 19, 2010 2:26 pm

Can I suggest this site instead of blockacountry.com?

http://www.ip2location.com/blockvisitorsbycountry.aspx

I've noticed that they update their databases every month

and I used their htaccess to block "one particular country" which sent me a lot of hackers >:( >:( >:(

Newbie

Posts

Joined
Tue Jan 19, 2010 2:14 pm

Post by ladypatty » Wed Jan 27, 2010 1:33 am

Hey thanks for the url !!
I too needed to block a county !!

Lady Patty
[* Remember when you point your finger at someone
three of your own fingers point back at you* ]


User avatar
Newbie

Posts

Joined
Fri Nov 06, 2009 4:02 am
Location - Indiana

Post by byens » Sat Feb 15, 2014 11:54 am

download complete database , upload to your hosting (folder ipfiles)
from http://www.phptutorial.info/iptocountry/the_script.html

place your code above index.php to allow only us visitor, modify with your needs.

Code: Select all

<?
/*Blocking country*/
  if ($_SERVER['HTTP_X_FORWARDED_FOR'])
  $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
else
  $ip   = $_SERVER['REMOTE_ADDR'];
 
$two_letter_country_code=iptocountry($ip);
 
function iptocountry($ip)
{
  $numbers = explode( ".", $ip);
 
  include("ip_files/".$numbers[0].".php");
  $code=($numbers[0] * 16777216) + ($numbers[1] * 65536) + ($numbers[2] * 256) + ($numbers[3]);    
 
  foreach($ranges as $key => $value)
  {
    if($key<=$code)
    {
      if($ranges[$key][0]>=$code)
      {
        $country=$ranges[$key][1];break;
      }
    }
  }
 
  if ($country=="")
  {
    $country="unknown";
  }
 
  return $country;
}
    if ($two_letter_country_code != "US")
  die();
/*Blocking country*/
?>

Selling Kristik - Jasa Foto Aura - Jual Lingerie - supplier baju anak - jasa seo


Active Member

Posts

Joined
Sat Dec 11, 2010 12:29 pm
Location - Surabaya

Post by byens » Sat Feb 15, 2014 11:58 am

Code: Select all

if ($two_letter_country_code = "US")
  die();
this code blocking US country only

Selling Kristik - Jasa Foto Aura - Jual Lingerie - supplier baju anak - jasa seo


Active Member

Posts

Joined
Sat Dec 11, 2010 12:29 pm
Location - Surabaya
Who is online

Users browsing this forum: Google [Bot] and 58 guests