Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How to ban a range of IP or a region


Guest

Recommended Posts

Posted

I sell download products and the delivery is immediate. Orders from some regions are almost 100% fraudulent. The gateway only provides a ban mechanism with IP address or IP class (with 3 sections), but not an IP range. For instance, the IP address allocated to Vietnam Posts and Telecommunications is 221.132.0.0 - 221.132.63.255. I want to ban the entire range. Is there a way or a contribution in osCommerce to ban a range of IP address?

Posted

Hi user99999999,

 

Is there a list of IP's that belong to each specific country?

Posted

Thank you for the reply. I checked the syntax of deny from clause. It seems that I cannot put a range. It only supports IP or broad IP such as 221.132.*.*. For the range I have, I need to have a list as:

 

221.132.0.*

221.132.1.*

221.132.2.*

...

221.132.63.*

 

That is not practical since I have a lots of IP ranges like this That I want to deny.

 

Perhaps there is way to add an php header such as:

 

<?php

$blocklist = array("...", "...", ...); // a list of IP or IP range that you want to deny

 

if ($_SERVER['REMOTE_ADDR'] falls into one of the range listed in blocklist)) {

header("Location: your information why the access is denied");

exit();

}

?>

 

I was wondering if there is any contribution that I can use.

 

 

Add to .htaccess file in website document root

 

deny from 221.132.0.0 - 221.132.63.255

 

http://httpd.apache.org/docs/1.3/mod/mod_access.html

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...