iQ Block Country - Version 1.2.11

Version Description

  • Change: Minor UI fix
  • Change: Added some more checking if the visitors IP is an actual IPv4 or IPv6 address
  • Change: Updated README
Download this release

Release Info

Developer iqpascal
Plugin Icon 128x128 iQ Block Country
Version 1.2.11
Comparing to
See all releases

Code changes from version 1.2.10 to 1.2.11

iq-block-country.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Plugin Name: iQ Block Country
4
  Plugin URI: https://www.webence.nl/plugins/iq-block-country-the-wordpress-plugin-that-blocks-countries-for-you/
5
- Version: 1.2.10
6
  Author: Pascal
7
  Author URI: https://www.webence.nl/
8
  Description: Block visitors from visiting your website and backend website based on which country their IP address is from. The Maxmind GeoIP lite database is used for looking up from which country an ip address is from.
@@ -13,7 +13,7 @@ Domain Path: /lang
13
 
14
  /* This script uses GeoLite Country from MaxMind (http://www.maxmind.com) which is available under terms of GPL/LGPL */
15
 
16
- /* Copyright 2010-2020 Pascal (email: pascal@webence.nl)
17
 
18
  This program is free software; you can redistribute it and/or modify
19
  it under the terms of the GNU General Public License, version 2, as
@@ -122,14 +122,20 @@ function iqblockcountry_get_ipaddress() {
122
  {
123
  if ( isset($_SERVER[$ipoverride]) && !empty($_SERVER[$ipoverride]))
124
  {
125
- $ip_address = $_SERVER[$ipoverride];
 
 
 
126
  }
127
  }
128
 
129
  // Get first ip if ip_address contains multiple addresses
130
  $ips = explode(',', $ip_address);
131
- $ip_address = trim($ips[0]);
132
 
 
 
 
 
133
  if ($ip_address == $server_address)
134
  {
135
  if ( isset($_SERVER['REMOTE_ADDR']) && !empty($_SERVER['REMOTE_ADDR']) ) {
2
  /*
3
  Plugin Name: iQ Block Country
4
  Plugin URI: https://www.webence.nl/plugins/iq-block-country-the-wordpress-plugin-that-blocks-countries-for-you/
5
+ Version: 1.2.11
6
  Author: Pascal
7
  Author URI: https://www.webence.nl/
8
  Description: Block visitors from visiting your website and backend website based on which country their IP address is from. The Maxmind GeoIP lite database is used for looking up from which country an ip address is from.
13
 
14
  /* This script uses GeoLite Country from MaxMind (http://www.maxmind.com) which is available under terms of GPL/LGPL */
15
 
16
+ /* Copyright 2010-2021 Pascal (email: pascal@webence.nl)
17
 
18
  This program is free software; you can redistribute it and/or modify
19
  it under the terms of the GNU General Public License, version 2, as
122
  {
123
  if ( isset($_SERVER[$ipoverride]) && !empty($_SERVER[$ipoverride]))
124
  {
125
+ if (iqblockcountry_is_valid_ipv4($_SERVER[$ipoverride]) || iqblockcountry_is_valid_ipv6($_SERVER[$ipoverride]))
126
+ {
127
+ $ip_address = $_SERVER[$ipoverride];
128
+ }
129
  }
130
  }
131
 
132
  // Get first ip if ip_address contains multiple addresses
133
  $ips = explode(',', $ip_address);
 
134
 
135
+ if (iqblockcountry_is_valid_ipv4(trim($ips[0])) || iqblockcountry_is_valid_ipv6(trim($ips[0])))
136
+ {
137
+ $ip_address = trim($ips[0]);
138
+ }
139
  if ($ip_address == $server_address)
140
  {
141
  if ( isset($_SERVER['REMOTE_ADDR']) && !empty($_SERVER['REMOTE_ADDR']) ) {
libs/blockcountry-settings.php CHANGED
@@ -1842,7 +1842,7 @@ function iqblockcountry_settings_page() {
1842
  <a href="?page=iq-block-country/libs/blockcountry-settings.php&tab=backend" class="nav-tab <?php echo $active_tab == 'backend' ? 'nav-tab-active' : ''; ?>"><?php _e('Backend', 'iq-block-country'); ?></a>
1843
  <a href="?page=iq-block-country/libs/blockcountry-settings.php&tab=pages" class="nav-tab <?php echo $active_tab == 'pages' ? 'nav-tab-active' : ''; ?>"><?php _e('Pages', 'iq-block-country'); ?></a>
1844
  <a href="?page=iq-block-country/libs/blockcountry-settings.php&tab=categories" class="nav-tab <?php echo $active_tab == 'categories' ? 'nav-tab-active' : ''; ?>"><?php _e('Categories', 'iq-block-country'); ?></a>
1845
- <a href="?page=iq-block-country/libs/blockcountry-settings.php&tab=tags" class="nav-tab <?php echo $active_tab == 'categories' ? 'nav-tab-active' : ''; ?>"><?php _e('Tags', 'iq-block-country'); ?></a> <a href="?page=iq-block-country/libs/blockcountry-settings.php&tab=posttypes" class="nav-tab <?php echo $active_tab == 'posttypes' ? 'nav-tab-active' : ''; ?>"><?php _e('Post types', 'iq-block-country'); ?></a>
1846
  <a href="?page=iq-block-country/libs/blockcountry-settings.php&tab=services" class="nav-tab <?php echo $active_tab == 'services' ? 'nav-tab-active' : ''; ?>"><?php _e('Services', 'iq-block-country'); ?></a>
1847
  <a href="?page=iq-block-country/libs/blockcountry-settings.php&tab=tools" class="nav-tab <?php echo $active_tab == 'tools' ? 'nav-tab-active' : ''; ?>"><?php _e('Tools', 'iq-block-country'); ?></a>
1848
  <a href="?page=iq-block-country/libs/blockcountry-settings.php&tab=logging" class="nav-tab <?php echo $active_tab == 'logging' ? 'nav-tab-active' : ''; ?>"><?php _e('Logging', 'iq-block-country'); ?></a>
1842
  <a href="?page=iq-block-country/libs/blockcountry-settings.php&tab=backend" class="nav-tab <?php echo $active_tab == 'backend' ? 'nav-tab-active' : ''; ?>"><?php _e('Backend', 'iq-block-country'); ?></a>
1843
  <a href="?page=iq-block-country/libs/blockcountry-settings.php&tab=pages" class="nav-tab <?php echo $active_tab == 'pages' ? 'nav-tab-active' : ''; ?>"><?php _e('Pages', 'iq-block-country'); ?></a>
1844
  <a href="?page=iq-block-country/libs/blockcountry-settings.php&tab=categories" class="nav-tab <?php echo $active_tab == 'categories' ? 'nav-tab-active' : ''; ?>"><?php _e('Categories', 'iq-block-country'); ?></a>
1845
+ <a href="?page=iq-block-country/libs/blockcountry-settings.php&tab=tags" class="nav-tab <?php echo $active_tab == 'tags' ? 'nav-tab-active' : ''; ?>"><?php _e('Tags', 'iq-block-country'); ?></a> <a href="?page=iq-block-country/libs/blockcountry-settings.php&tab=posttypes" class="nav-tab <?php echo $active_tab == 'posttypes' ? 'nav-tab-active' : ''; ?>"><?php _e('Post types', 'iq-block-country'); ?></a>
1846
  <a href="?page=iq-block-country/libs/blockcountry-settings.php&tab=services" class="nav-tab <?php echo $active_tab == 'services' ? 'nav-tab-active' : ''; ?>"><?php _e('Services', 'iq-block-country'); ?></a>
1847
  <a href="?page=iq-block-country/libs/blockcountry-settings.php&tab=tools" class="nav-tab <?php echo $active_tab == 'tools' ? 'nav-tab-active' : ''; ?>"><?php _e('Tools', 'iq-block-country'); ?></a>
1848
  <a href="?page=iq-block-country/libs/blockcountry-settings.php&tab=logging" class="nav-tab <?php echo $active_tab == 'logging' ? 'nav-tab-active' : ''; ?>"><?php _e('Logging', 'iq-block-country'); ?></a>
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === iQ Block Country ===
2
  Contributors: iqpascal
3
- Donate link: https://www.webence.nl/plugins/donate
4
  Tags: spam, block, country, comments, ban, geo, geo blocking, geo ip, block country, block countries, ban countries, ban country, allow list, block list, security
5
  Requires at least: 3.5.2
6
- Tested up to: 5.5.1
7
- Stable tag: 1.2.10
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  Requires PHP: 5.6
@@ -35,6 +35,11 @@ If you cannot or do not want to download the GeoIP database from Maxmind you can
35
  If you want to use the GeoLite database from Maxmind you will have to download the GeoIP database from MaxMind directly and upload it to your site.
36
  The Wordpress license does not allow this plugin to download the MaxMind Geo database for you.
37
 
 
 
 
 
 
38
  Do you need help with this plugin? Please email support@webence.nl.
39
 
40
  = GDPR Information =
@@ -92,7 +97,6 @@ This however does not mean this plugin does not work, it just means somebody tri
92
 
93
  If you are worried this plugin does not work you could try to block your own country or your own ip address 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.
94
 
95
-
96
  = This plugin does not work, I blocked a country and still see visitors! =
97
 
98
  Well, this plugin does in fact work but is limited to the data MaxMind provides. Also in your statistics software or logfiles you probably will see log entries from countries that you have blocked. See the "How come I still see visitors..." FAQ for that.
@@ -237,6 +241,12 @@ be used.
237
 
238
  == Changelog ==
239
 
 
 
 
 
 
 
240
  = 1.2.10 =
241
 
242
  * Change: Changed whitelist/blacklist to allow list / block list.
@@ -308,4 +318,4 @@ be used.
308
 
309
  = 1.1.19 =
310
 
311
- This plugin no longer downloads the MaxMind database. You have to download manually or use the GeoIP API.
1
  === iQ Block Country ===
2
  Contributors: iqpascal
3
+ Donate link: https://webence.nl/plugins/donate
4
  Tags: spam, block, country, comments, ban, geo, geo blocking, geo ip, block country, block countries, ban countries, ban country, allow list, block list, security
5
  Requires at least: 3.5.2
6
+ Tested up to: 5.7
7
+ Stable tag: 1.2.11
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  Requires PHP: 5.6
35
  If you want to use the GeoLite database from Maxmind you will have to download the GeoIP database from MaxMind directly and upload it to your site.
36
  The Wordpress license does not allow this plugin to download the MaxMind Geo database for you.
37
 
38
+ Please be aware that although this plugin can help you greatly with reducing the number of 'bad' visitors on your website it is not fool proof and those who really want to visit your site may find a away.
39
+ This is not a security issue but a simple fact of today. Nobody can guarantee you 100% security as it is a constant battle between the good guys and the bad guys.
40
+
41
+ If you are sure your webhosting or yourself does not use any form of caching or proxying we recommend setting the "Override IP information" on the Home tab to REMOTE_ADDR
42
+
43
  Do you need help with this plugin? Please email support@webence.nl.
44
 
45
  = GDPR Information =
97
 
98
  If you are worried this plugin does not work you could try to block your own country or your own ip address 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.
99
 
 
100
  = This plugin does not work, I blocked a country and still see visitors! =
101
 
102
  Well, this plugin does in fact work but is limited to the data MaxMind provides. Also in your statistics software or logfiles you probably will see log entries from countries that you have blocked. See the "How come I still see visitors..." FAQ for that.
241
 
242
  == Changelog ==
243
 
244
+ = 1.2.11 =
245
+
246
+ * Change: Minor UI fix
247
+ * Change: Added some more checking if the visitors IP is an actual IPv4 or IPv6 address
248
+ * Change: Updated README
249
+
250
  = 1.2.10 =
251
 
252
  * Change: Changed whitelist/blacklist to allow list / block list.
318
 
319
  = 1.1.19 =
320
 
321
+ This plugin no longer downloads the MaxMind database. You have to download manually or use the GeoIP API.