It can be downloaded from the extension’s page.
As my paid work has remained slow in May, I’m working on yet another extension. This extension filters traffic by country code. An administrator can either allow traffic only from selected countries, or not allow traffic from selected countries. Some forums attract a lot of spam, often times robots from countries like Ukraine, Russia or Belarus. 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 will prohibit the rest.
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. The database is updated weekly by MaxMind and is automatically refreshed using a phpBB cron job.
There are other ways to block traffic by country. For example, CloudFlare has a paid service that can do this. This has the advantage of keeping this traffic from ever hitting your site, which reduces server resources used. This extension will show a blocked message, but will present standard forum headers and footers. However, clicking on any link will simply bring up the same message. The extension though has some unique and special features that make it more useful than a basic IP block:
- A setting allows registered users in blocked countries to login. This basically enables the login link. If they can provide a valid username and password, they can login. However, this does not allow registration.
- 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. It may also help accommodate VPNs. See the discussion below.
- You can log all blocked page requests. The log entry will identify the user (which could be “Anonymous” for guest), the IP used and the country. One downside is that this could make for some very large log tables.
- 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.
Here are the two screen interfaces developed so far in version 1.0.0-dev.
Since a lot of people use virtual private networks (VPNs) today, it’s unclear how well this solution will address these. If the address of a VPN is not in this database, it can be allowed using the setting described above. MaxMind sells a separate database of anonymous IPs used by VPNs. I may integrate an interface to check this database too, but it will depend on users buying a subscription from MaxMind for this database. In general, the phpBB Group frowns on ties to commercial paid products.
Since this is in development, it’s a long way from being approved. You should not use it on a production forum.
It’s been tested, but it’s the kind of extension where it really needs to be tested on a site with a fair amount of traffic. You can participate in the discussion on my phpbb.com topic here. It can be downloaded here or you can grab it from my GitHub archive.