iQ Block Country (a WordPress plugin)

iQ Block Country is a wordpress plugin that allows you to block visitors based on from which country they are from.

This plugin is tested with WordPress 2.9.2, this is also the version which was first used to test it so no guarantees it will work on prior versions. This plugin also works for WordPress 3.0.1

Latest version: 1.0.4

Description

If you want to block people from certain (obscure) countries that have no business visiting your blog and perhaps only leave spam comments or other harmful actions than this is the plugin for you.

Choose which countries you want to ban from visiting your blog. Any visitors from that country get a HTTP/403 error with the message “Forbidden – Users from your country are not permitted to browse this site.

They will not be able to do harmful things to your blog like post comment spam.

This plugin uses the GeoLite database from Maxmind. It has a 99.5% accuracy so that is pretty good.

Once you setup this plugin it will try to download the GeoIP database from Maxmind so you will always have a recent version of the database when installing this plugin.

Installation

1. Unzip the archive and put the `iq-block-country` folder into your plugins folder (/wp-content/plugins/).

2. Activate the plugin through the ‘Plugins’ menu in WordPress

3. Go to the settings page and choose which countries you want to ban. Use the ctrl key to select

multiple countries

4. Check if it downloaded the GeoIP database from MaxMind otherwise follow instructions on screen.

Frequently Asked Questions

Q: Does this plugin also work with IPv6?

A: No not yet. Maxmind has a GeoIPv6 database though just no support for PHP yet.

And as my blog is also reachable on IPv6 I might incoporate this database as soon this is possible.

However: We need more IPv6 out there so please DO ask your hosting provider for IPv6!

Q: How can I get a new version of the GeoIP database?

A: You can remove the file GeoIP.dat from the plugin directory and after removal go to the settings page of this plugin. When it sees the GeoIP database is missing it will try to download it for you.

However you can also download the GeoIP database yourself from Maxmind and overwrite the existing database.

Since version 1.0.4 you can also press the “Download new GeoIP database” button in the admin menu.

Maxmind updates the GeoLite database every month.

Q: Help it gives some error about not being able to download the GeoIP database?

A: Follow the instructions on screen. It will probably tell you that you have to manually download the GeoIP database from Maxmind from the following url:

http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz

It will also give you the location it expects the GeoIP.dat file. So go ahead and download it and unzip the file to this specific location.

Q: How come that I still see visitors from countries that I blocked in Statpress or other statistics software?

A: It’s true that you might see hits from countries that you have blocked in your statistics software. That is the way it works, certain plugins may be run before iQ Block Country is run so it may log visitors to pages. This however does not mean this plugin does not work, it just means somebody tried to access a certain page or pages and that that fact is logged.

If you are worried this plugin does not work you could try to block your own country and afterwards visit your frontend website and see if it actually works. Also if you have access to the logfiles of the webserver that hosts your website  you can see that these visitors are actually denied with a HTTP error 403.

Changelog

v1.0.4

  • Added a button to download the new GeoIP database.

v1.0.3

  • Updated the FAQ
  • Try to make sure this plugin is loaded first to avoid “headers already sent” trouble.

v1.0.2

  • PHP 5.2 or higher required
  • Fixed an include bug when other plugins also use the MaxMind database. Thanks to Marcus from LunaWorX for finding this bug.

v1.0.1

  • Included the necessary geoip.inc file

v1.0

  • Initial release

Upgrade Notice

v1.0.3

This baby should just upgrade fine. You may want to deactivate and reactivate this plugin to make (pretty) sure this
plugin is loaded first. This especially recommended if you have problems with ‘headers already sent’ notices.

v1.0.2

PHP 5.2 or higher is now required.

Just upgrade if you have PHP 5.2 or higher.

v1.0.1

You can just upgrade. Actually we urge you to as else this plugin won’t work. :-)

v1.0

Initial release

Download

You can download this plugin from the WordPress Plugin site: http://wordpress.org/extend/plugins/iq-block-country/

Planned features

  • IPv6 support
  • Blacklist ip addresses as sometimes you just don’t want to ban an entire country
  • Whitelist ip addresses, maybe you want to ban a whole country except some good guys

Feature requests

If you miss a certain feature or if you would like to see something else changed or added please let me know. I am open to any suggestion that may improve this plugin.

Gerelateerde artikelen:

  1. Weg met de Russen…
  2. Statpress Reload & Windows 7

U kunt reacties op dit bericht volgen via de RSS 2.0 feed. U kunt een bericht achterlaten, of een trackback geven op uw eigen site.

108 reacties »

 
  • DC zegt:

    how can i change the block message from “Forbidden – users from your country are not allowed to view this site” to something else. I tried to edit the .php file in WP plugins editor but it wont save, keeps reverting back to the original message.

    • Pascal zegt:

      The only way at this moment is to edit the PHP code. Perhaps if it doesn’t work through the editor you can FTP the file to your desktop and edit it by notepad (or vi ofcourse :-) )

  • Joe zegt:

    Hello, thanks for your hard work. When using IQBlock Country how do we see the growing list of blocked countries? We select and save, but a list of blocked countries does not appear on the screen or in the code?

    Please advise?
    Thank you.

    • Pascal zegt:

      Hi,

      The way you van view which countries are selected is by scrolling down the selection list after submit. All selected countries should remain selected.

      Which countries are actually selected is written to the wordpress database so you can also see it also in the database if you are a more advanced user (by country code).

  • Patrick zegt:

    Are you able to block a country but allow certain ip addresses access?

 

Geef een reactie

XHTML: Je kunt deze tags gebruiken <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>