Filter by country

Introduction

This extension filters traffic by country. An administrator can either allow traffic from selected countries only, or not allow any traffic from selected countries. It helps reduce unwanted traffic to a forum and makes the forum’s content entirely inaccessible to blocked countries.

The extension uses the free MaxMind GeoLite2 country database, which is downloaded upon first use of the extension. The database examines the IP address of the user and determines the country of origin.

Some forums attract a lot of spam, often times malicious robots from countries like Ukraine, Russia or Belarus trying to create spam accounts and spam posts. This extension may be part of this solution. Other forums really don’t want traffic from outside the country because their focus is strictly national, or applies only to a set of given countries. This extension can prohibit the rest.

There are other ways to block traffic by country. For example, CloudFlare has a paid service that can do this. These solutions have the advantage of keeping this traffic from ever hitting your site, which reduces server resources used. This extension though might be preferable, as it has features that allow registered users to login even if their country is blocked, if this feature is enabled.

Blocking access

To traffic from unwanted countries, this extension shows a blocked message, but will present standard forum headers and footers. This is the standard blocked message:

The administrator can allow registered users to login even if their access is from a blocked country. If so, they will see this blocked message, with an embedded login link that will work.

Note: although the links can be clicked on, they all return the same blocked page. This includes the registration link, a typical entry point for malicious programs. No forums can be seen. No content at all is available other than what is available in the header and footer.

Administration Control Panel

Here is the administrator’s user interface for the extension. After installation, you will find it on the extensions tab in the Administration Control Panel.

Other features

The extension though has some unique and special features that make it more useful than a basic IP block:

  • VPN allow/disallow. In the event an IP address does not match to a country, a setting can allow or deny access. New IPs are added from time to time, so this accommodates this possibility. Most of the time these IPs are associated with Virtual Private Networks.
  • Logging. You can log all blocked page requests. The log entry will identify the user (which could be “Anonymous”, for guests), the IP used and the country. One downside is that this could make for some very large log tables.
  • Statistics. You can keep statistics on the number of allowed and blocked page requests by country and see the details in a report. This too can result in some large tables. The statistics can be filtered by a relative range or an absolute range of dates. The columns can be sorted in ascending or descending sequence.
  • Weekly automatic database update. The database is refreshed approximately once a week automatically using a phpBB cron.

Language support

Currently English and Dutch language translations are available. If you have one to contribute, please let me know.

Status

This extension is in release candidate status. You should not use it on a production forum.

Downloads and support

You can participate in the discussion on my phpbb.com topic here

Versions

You can always grab versions from my GitHub archive. If downloaded from GitHub, make sure to place it in a /ext/phpbbservices/filterbycountry directory.