Changeset 3166044
- Timestamp:
- 10/09/2024 05:21:20 PM (14 months ago)
- Location:
- rc-geo-access
- Files:
-
- 3 added
- 4 edited
-
assets/screenshot-1.png (modified) (previous)
-
tags/1.49 (added)
-
tags/1.49/rc-geo-access.php (added)
-
tags/1.49/readme.txt (added)
-
trunk/changelog.txt (modified) (1 diff)
-
trunk/rc-geo-access.php (modified) (23 diffs)
-
trunk/readme.txt (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
rc-geo-access/trunk/changelog.txt
r2844071 r3166044 1 1 # Changelog 2 3 ## 1.49 4 5 - Added support for OpenLiteSpeed web server’s local Geolocation functionality, this removes the need for an external third-party geolocation API if you are serving websites using OLS. See more details about how to configure this in OLS here: https://docs.openlitespeed.org/config/advanced/geolocation/#enabling-geolocation 2 6 3 7 ## 1.48 -
rc-geo-access/trunk/rc-geo-access.php
r2844071 r3166044 4 4 Plugin URI: https://qreate.co.uk/projects/#rcgeoaccess 5 5 Description: This plugin restricts access to the login page of your WordPress Admin based on the location of the user trying to access it. 6 Version: 1.4 86 Version: 1.49 7 7 Author: Rick Curran 8 8 Author URI: https://qreate.co.uk … … 30 30 $options = get_option( 'rc_geo_access_settings' ); 31 31 32 if ( ( !isset( $options[ 'rc_geo_access_status' ] ) && !isset( $options[ 'rc_geo_access_ipstack_api_key' ] ) ) || ( $options[ 'rc_geo_access_status' ] !== 'enabled' && $options[ 'rc_geo_access_ipstack_api_key' ] === '' ) ) { 32 if ( 33 ( !isset( $options[ 'rc_geo_access_status' ] ) && !isset( $options[ 'rc_geo_access_ipstack_api_key' ] ) ) || ( $options[ 'rc_geo_access_status' ] !== 'enabled' && $options[ 'rc_geo_access_ipstack_api_key' ] === '' ) || 34 ( !isset( $options[ 'rc_geo_access_status' ] ) && !isset( $options[ 'rc_geo_access_ipgeolocation_api_key' ] ) ) || ( $options[ 'rc_geo_access_status' ] !== 'enabled' && $options[ 'rc_geo_access_ipgeolocation_api_key' ] === '' ) || 35 ( !isset( $options[ 'rc_geo_access_status' ] ) && !isset( $options[ 'rc_geo_access_openlitespeed_local_geoip' ] ) ) || ( $options[ 'rc_geo_access_status' ] !== 'enabled' && $options[ 'rc_geo_access_openlitespeed_local_geoip' ] === '' ) 36 ) { 33 37 34 38 if ( is_admin() ) { … … 69 73 add_settings_field( 'rc_geo_access_ipgeolocation_api_key', __( 'IPGeolocation API Key:', 'rc_geo_access_plugin' ), 'rc_geo_access_ipgeolocation_api_key_render', 'rc_geo_access_admin_page', 'rc_geo_access_admin_page_section' ); 70 74 75 add_settings_field( 'rc_geo_access_openlitespeed_local_geoip', __( 'OpenLiteSpeed GeoIP:', 'rc_geo_access_plugin' ), 'rc_geo_access_openlitespeed_local_geoip_render', 'rc_geo_access_admin_page', 'rc_geo_access_admin_page_section' ); 76 71 77 add_settings_field( 'rc_geo_access_restricted_countries', __( 'Country Whitelist:', 'rc_geo_access_plugin' ), 'rc_geo_access_restricted_countries_render', 'rc_geo_access_admin_page', 'rc_geo_access_admin_page_section' ); 72 78 … … 96 102 if ( $options[ 'rc_geo_access_email_recipient' ] === '' ) { 97 103 98 echo '<p style="color:darkorange;font-weight:bold;">↑ ' . __( 'Please enter a valid email address to receive notifications.', 'rc_geo_access_plugin' ) . '</p>';104 echo '<p style="color:darkorange;font-weight:bold;">↑ ' . __( 'Please enter a valid email address to receive notifications.', 'rc_geo_access_plugin' ) . '</p>'; 99 105 100 106 } … … 104 110 if ( ! is_email( $options[ 'rc_geo_access_email_recipient' ] ) ) { 105 111 106 echo '<p style="color:darkorange;font-weight:bold;">↑ ' . __( 'Sorry, that doesn\'t appear to be a valid email address, please check your typing and try again.', 'rc_geo_access_plugin' ) . ' -' . $options[ 'rc_geo_access_email_recipient' ] . '-</p>';112 echo '<p style="color:darkorange;font-weight:bold;">↑ ' . __( 'Sorry, that doesn\'t appear to be a valid email address, please check your typing and try again.', 'rc_geo_access_plugin' ) . ' -' . $options[ 'rc_geo_access_email_recipient' ] . '-</p>'; 107 113 108 114 } … … 134 140 <select name='rc_geo_access_settings[rc_geo_access_api_provider]'> 135 141 <option value="">Select...</option> 136 <option value='ipgeolocation' <?php selected( $options[ 'rc_geo_access_api_provider' ], 'ipgeolocation' ); ?>>ipgeolocation</option> 137 <option value='ipstack' <?php selected( $options[ 'rc_geo_access_api_provider' ], 'ipstack' ); ?>>ipstack</option> 142 <option value='ipgeolocation' <?php selected( $options[ 'rc_geo_access_api_provider' ], 'ipgeolocation' ); ?>>ipgeolocation.io</option> 143 <option value='ipstack' <?php selected( $options[ 'rc_geo_access_api_provider' ], 'ipstack' ); ?>>ipstack.com</option> 144 <option value='openlitespeed' <?php selected( $options[ 'rc_geo_access_api_provider' ], 'openlitespeed' ); ?>>OpenLiteSpeed’s local GeoIP variable</option> 138 145 </select> 139 146 140 147 <?php 141 148 if ( $options[ 'rc_geo_access_api_provider' ] == '' ) { 142 echo '<p style="color:darkorange;font-weight:bold;">↑ ' . __( 'Please select an API provider from the menu above.', 'rc_geo_access_plugin' ) . '</p>';149 echo '<p style="color:darkorange;font-weight:bold;">↑ ' . __( 'Please select an API provider from the menu above.', 'rc_geo_access_plugin' ) . '</p>'; 143 150 } 144 151 } … … 157 164 if ( $options[ 'rc_geo_access_status' ] === 'disabled' ) { 158 165 159 echo '<p style="color:darkorange;font-weight:bold;">↑ ' . __( 'Change this to "Enabled" to turn on access restriction', 'rc_geo_access_plugin' ) . '</p>';166 echo '<p style="color:darkorange;font-weight:bold;">↑ ' . __( 'Change this to "Enabled" to turn on access restriction', 'rc_geo_access_plugin' ) . '</p>'; 160 167 161 168 } … … 180 187 if ( $options[ 'rc_geo_access_ipstack_api_key' ] === '' && $options[ 'rc_geo_access_api_provider' ] === 'ipstack' ) { 181 188 182 echo '<p style="color:darkorange;font-weight:bold;">↑ ' . __( 'Please enter an API Key. This is required for access restriction to function', 'rc_geo_access_plugin' ) . '</p>';189 echo '<p style="color:darkorange;font-weight:bold;">↑ ' . __( 'Please enter an API Key. This is required for access restriction to function', 'rc_geo_access_plugin' ) . '</p>'; 183 190 184 191 } … … 195 202 196 203 if ( $rc_geo_access_error_status !== '' && $rc_geo_access_provider == 'ipstack' ) { // If errors then display message... 197 echo '<p style="color: darkorange;font-weight:bold;">↑' . $rc_geo_access_error_status . '</p>';204 echo '<p style="color:#fff;font-weight:bold;padding:10px;border-radius:8px;background-color:red;">↑ ' . $rc_geo_access_error_status . '</p>'; 198 205 } 199 206 … … 221 228 if ( $options[ 'rc_geo_access_ipgeolocation_api_key' ] === '' && $options[ 'rc_geo_access_api_provider' ] === 'ipgeolocation' ) { 222 229 223 echo '<p style="color:darkorange;font-weight:bold;">↑ ' . __( 'Please enter an API Key. This is required for access restriction to function', 'rc_geo_access_plugin' ) . '</p>';230 echo '<p style="color:darkorange;font-weight:bold;">↑ ' . __( 'Please enter an API Key. This is required for access restriction to function', 'rc_geo_access_plugin' ) . '</p>'; 224 231 225 232 } … … 236 243 237 244 if ( $rc_geo_access_error_status !== '' && $rc_geo_access_provider == 'ipgeolocation' ) { // If errors then display message... 238 echo '<p style="color:darkorange;font-weight:bold;">↑' . $rc_geo_access_error_status . '</p>'; 245 echo '<p style="color:#fff;font-weight:bold;padding:10px;border-radius:8px;background-color:red;">↑ ' . $rc_geo_access_error_status . '</p>'; 246 } 247 248 } 249 250 } 251 252 function rc_geo_access_openlitespeed_local_geoip_render() { 253 254 $options = get_option( 'rc_geo_access_settings' ); 255 $rc_geo_access_provider = $options[ 'rc_geo_access_api_provider' ]; 256 257 $rc_geo_access_ipstack_api_key = $options[ 'rc_geo_access_ipstack_api_key' ]; 258 $rc_geo_access_ipgeolocation_api_key = $options[ 'rc_geo_access_ipgeolocation_api_key' ]; 259 $rc_geo_access_openlitespeed_local_geoip = $options[ 'rc_geo_access_openlitespeed_local_geoip' ]; 260 261 $rc_geo_access_api_warn = ''; 262 if ( $rc_geo_access_provider == 'openlitespeed' && ( $rc_geo_access_ipgeolocation_api_key != '' || $rc_geo_access_ipstack_api_key != '' ) ) { 263 $rc_geo_access_api_warn = '<p style="color:darkorange;font-weight:normal;">You have selected <strong>OpenLiteSpeed\'s local GeoIP variable</strong> as your geolocation API provider, only enter an API key in the <strong>ipgeolocation.io</strong> or <strong>ipstack.com</strong> API Key fields if using those APIs.</p>'; 264 } 265 266 ?> 267 <input type='text' name='rc_geo_access_settings[rc_geo_access_openlitespeed_local_geoip]' value='NO API KEY REQUIRED' size="50" readonly> 268 <?php 269 if ( $options[ 'rc_geo_access_openlitespeed_local_geoip' ] === '' && $options[ 'rc_geo_access_api_provider' ] === 'openlitespeed' ) { 270 271 echo '<p style="color:darkorange;font-weight:bold;">↑ ' . __( 'Please ensure a Geolocation database is configured on your OpenLiteSpeed server. This is required for access restriction to function', 'rc_geo_access_plugin' ) . '</p>'; 272 273 } 274 275 echo $rc_geo_access_api_warn; 276 277 // Check if API Key has any errors... 278 if ( $options[ 'rc_geo_access_status' ] === 'enabled' && $options[ 'rc_geo_access_openlitespeed_local_geoip' ] !== '' ) { 279 280 // Lookup current admin user's location... 281 $rc_geo_access_api_result = rc_geo_access_lookup_ip( $_SERVER[ 'REMOTE_ADDR' ], $options[ 'rc_geo_access_openlitespeed_local_geoip' ], $options[ 'rc_geo_access_api_provider' ] ); 282 // ...and then check response for any errors relating to the API key... 283 $rc_geo_access_error_status = rc_geo_access_error_handling( $rc_geo_access_api_result, $rc_geo_access_provider ); 284 285 if ( $rc_geo_access_error_status !== '' && $rc_geo_access_provider == 'openlitespeed' ) { // If errors then display message... 286 echo '<p style="color:#fff;font-weight:bold;padding:10px;border-radius:8px;background-color:red;">↑ ' . $rc_geo_access_error_status . '</p>'; 239 287 } 240 288 … … 253 301 } else if ( $rc_geo_access_provider == 'ipgeolocation' ) { 254 302 $rc_geo_access_api_key = $options[ 'rc_geo_access_ipgeolocation_api_key' ]; 303 304 } else if ( $rc_geo_access_provider == 'openlitespeed' ) { 305 $rc_geo_access_api_key = $options[ 'rc_geo_access_openlitespeed_local_geoip' ]; 255 306 } 256 307 … … 265 316 $rc_geo_access_no_countries_forced_country_code = ''; 266 317 267 if ( $options[ 'rc_geo_access_status' ] === 'enabled' && $rc_geo_access_provider !== '' && ( $options[ 'rc_geo_access_ipstack_api_key' ] !== '' || $options[ 'rc_geo_access_ipgeolocation_api_key' ] !== '' ) ) {318 if ( $options[ 'rc_geo_access_status' ] === 'enabled' && $rc_geo_access_provider !== '' && ( $options[ 'rc_geo_access_ipstack_api_key' ] !== '' || $options[ 'rc_geo_access_ipgeolocation_api_key' ] !== '' || $options[ 'rc_geo_access_openlitespeed_local_geoip' ] !== '' ) ) { 268 319 $rga_countries_whitelist_style = 'style="display:block;"'; 269 320 … … 290 341 } else if ( $rc_geo_access_provider == 'ipgeolocation' ) { 291 342 $rc_geo_access_country_code = $rc_geo_access_api_result[ 'country_code2' ]; 343 344 } else if ( $rc_geo_access_provider == 'openlitespeed' ) { 345 $rc_geo_access_country_code = $rc_geo_access_api_result[ 'geoip_country_code' ]; 292 346 } 293 347 … … 315 369 316 370 $checked = ''; 371 $il_style = 'padding:5px 10px 5px 8px;display:block;'; 317 372 if ( is_array($rc_geo_access_restricted_countries) && in_array( $v, $rc_geo_access_restricted_countries ) ) { 318 373 $checked = ' checked'; 374 $il_style = 'padding:5px 10px 5px 8px;display:block;background-color:#C1E1C1;border-radius:6px;'; 319 375 } 320 376 … … 322 378 if ( $rc_geo_access_no_countries_forced_country_code === $v ) { 323 379 $checked = ' checked'; 324 } 325 326 echo '<li><label style="padding:0 10px 0 8px;display:block;"><input type="checkbox" name="rc_geo_access_settings[rc_geo_access_restricted_countries][]" value="' . $v . '"' . $checked . '> <span>' . $k . ' - ' . $v . '</span></label></li>'; 380 $il_style = 'padding:5px 10px 5px 8px;display:block;background-color:#C1E1C1;border-radius:6px;'; 381 } 382 383 echo '<li><label style="' . $il_style . '"><input type="checkbox" name="rc_geo_access_settings[rc_geo_access_restricted_countries][]" value="' . $v . '"' . $checked . '> <span>' . $k . ' - ' . $v . '</span></label></li>'; 327 384 328 385 … … 341 398 echo __( ' 342 399 <p>This plugin restricts access to the login page of your WordPress Admin based on the location of the user trying to access it. Restricting access in this way can be a useful way of reducing unwanted login attempts.</p> 343 <p>To get the location of the user the plugin gets the IP address of the user attempting to access the login page and geo-locates their location by using a geolocation API, currently there are two services available to use:</p> 344 <ul> 345 <li><strong>ipstack:</strong> <a href="http://ipstack.com?utm_source=FirstPromoter&utm_medium=Affiliate&fpr=rick54" target="_blank">ipstack.com</a>.</li> 346 <li><strong>ipgeolocation:</strong> <a href="https://ipgeolocation.io/" target="_blank">ipgeolocation.io</a>.</li> 400 <p>The plugin gets the IP address of the user attempting to access the login page and geo-locates their location by using a geolocation API, currently there are three options available to use:</p> 401 <ul style="list-style:decimal;margin-left: 1.75rem;"> 402 <li><strong>ipstack.com:</strong> <a href="http://ipstack.com?utm_source=FirstPromoter&utm_medium=Affiliate&fpr=rick54" target="_blank">ipstack.com</a>.</li> 403 <li><strong>ipgeolocation.io:</strong> <a href="https://ipgeolocation.io/" target="_blank">ipgeolocation.io</a>.</li> 404 <li><strong>OpenLiteSpeed’s local GeoIP variables:</strong> <a href="https://docs.openlitespeed.org/config/advanced/geolocation/#enabling-geolocation" target="_blank">View OLS Enabling GeoLocation instructions</a>.</li> 347 405 </ul> 348 <p><strong>Please note: an active API Key is required for either of these this services for the plugin to function correctly.</strong> You can register a free account at either of the website addresses above. Please note they offer varying amounts of location API requests for their free and paid plans, it may be necessary to upgrade to a paid plan to provide an increased amount of requests if your site gets a huge amount of login attempts.</p>', 'rc_geo_access_plugin' );406 <p><strong>Please note: an active API Key or a specifically configured OpenLiteSpeed webserver is required for the plugin to function correctly.</strong> You can register a free account at either of the website addresses above. Please note they offer varying amounts of location API requests for their free and paid plans, it may be necessary to upgrade to a paid plan to provide an increased amount of requests if your site gets a huge amount of login attempts. The “OpenLiteSpeed" option requires a configured IPGeolocation database as per the linked instructions.</p>', 'rc_geo_access_plugin' ); 349 407 350 408 submit_button(); … … 430 488 } else if ( $rc_geo_access_provider == 'ipgeolocation' ) { 431 489 $rc_geo_access_api_key = $options[ 'rc_geo_access_ipgeolocation_api_key' ]; 490 491 } else if ( $rc_geo_access_provider == 'openlitespeed' ) { 492 //wp_die( 'HI openlitespeed' ); 493 $rc_geo_access_api_key = $options[ 'rc_geo_access_openlitespeed_local_geoip' ]; 494 432 495 } 433 496 … … 445 508 // Output the 2 letter "country_code" and other details... 446 509 if ( $rc_geo_access_provider == 'ipstack' ) { 447 $rc_geo_access_country_code = $rc_geo_access_api_result[ 'country_code' ]; 510 $rc_geo_access_country_code = $rc_geo_access_api_result[ 'country_code' ]; 511 $rc_geo_access_country_name = $rc_geo_access_api_result[ 'country_name' ]; 512 $rc_geo_access_longitude = $rc_geo_access_api_result[ 'longitude' ]; 513 $rc_geo_access_latitude = $rc_geo_access_api_result[ 'latitude' ]; 448 514 449 515 } else if ( $rc_geo_access_provider == 'ipgeolocation' ) { 450 $rc_geo_access_country_code = $rc_geo_access_api_result[ 'country_code2' ]; 451 } 452 $rc_geo_access_country_name = $rc_geo_access_api_result[ 'country_name' ]; 453 $rc_geo_access_longitude = $rc_geo_access_api_result[ 'longitude' ]; 454 $rc_geo_access_latitude = $rc_geo_access_api_result[ 'latitude' ]; 516 $rc_geo_access_country_code = $rc_geo_access_api_result[ 'country_code2' ]; 517 $rc_geo_access_country_name = $rc_geo_access_api_result[ 'country_name' ]; 518 $rc_geo_access_longitude = $rc_geo_access_api_result[ 'longitude' ]; 519 $rc_geo_access_latitude = $rc_geo_access_api_result[ 'latitude' ]; 520 521 } else if ( $rc_geo_access_provider == 'openlitespeed' ) { 522 $rc_geo_access_country_code = $rc_geo_access_api_result[ 'geoip_country_code' ]; 523 $rc_geo_access_country_name = $rc_geo_access_api_result[ 'country_name' ]; 524 $rc_geo_access_longitude = 'N/A'; 525 $rc_geo_access_latitude = 'N/A'; 526 } 455 527 456 528 // Get list of enabled countries... … … 526 598 } 527 599 600 } else { 601 error_log( 'RC GEO ACCESS - NO API KEY FOUND' ); 528 602 } 529 603 … … 581 655 } 582 656 657 } else if ( $rc_geo_access_provider == 'openlitespeed' ) { 658 // Check if `GEOIP_COUNTRY_CODE` and `GEOIP_COUNTRY_NAME` server variables exist... 659 if ( !isset( $_SERVER[ 'GEOIP_COUNTRY_CODE' ] ) || !isset( $_SERVER[ 'GEOIP_COUNTRY_NAME' ] ) ) { 660 $rga_error_status = __( 'Sorry, the OpenLiteSpeed GeoIP variables could not be read. This could be due to the IP address not being found in the Geolocation database. Please also check that you have configured the OLS geolocation lookup function correctly.', 'rc_geo_access_plugin' ); 661 } 662 583 663 } 584 664 … … 597 677 $ch = curl_init( 'http://api.ipstack.com/' . $ip . '?access_key=' . $rc_geo_access_key . '&fields=country_code,country_name,longitude,latitude' ); 598 678 curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); 679 680 $json = curl_exec( $ch ); 681 curl_close( $ch ); 682 // For PHP 8+ curl_close no longer has any effect, so `unset` should be used instead 683 unset( $ch ); 684 685 $rc_geo_access_api_result = json_decode( $json, true ); 599 686 600 687 } else if ( $rc_geo_access_provider == 'ipgeolocation' ) { … … 609 696 )); 610 697 611 } 612 613 $json = curl_exec( $ch ); 614 curl_close( $ch ); 615 // For PHP 8+ curl_close no longer has any effect, so `unset` should be used instead 616 unset( $ch ); 617 618 $rc_geo_access_api_result = json_decode( $json, true ); 619 698 $json = curl_exec( $ch ); 699 curl_close( $ch ); 700 // For PHP 8+ curl_close no longer has any effect, so `unset` should be used instead 701 unset( $ch ); 702 703 $rc_geo_access_api_result = json_decode( $json, true ); 704 705 } else if ( $rc_geo_access_provider == 'openlitespeed' ) { 706 707 708 $rc_geo_access_api_result_json = '{ "geoip_country_code": "' . $_SERVER[ 'GEOIP_COUNTRY_CODE' ] . '", "country_name": "' . $_SERVER[ 'GEOIP_COUNTRY_NAME' ] . '", "latitude": 0, "longitude": 0 }'; 709 710 $rc_geo_access_api_result = json_decode( $rc_geo_access_api_result_json, true ); 711 712 /*$geoip_country_code = $_SERVER[ 'GEOIP_COUNTRY_CODE' ] 713 $rc_geo_access_country_name = $_SERVER[ 'GEOIP_COUNTRY_NAME' ]; 714 $rc_geo_access_longitude = 'na'; 715 $rc_geo_access_latitude = 'na';*/ 716 717 //wp_die( print_r( $rc_geo_access_api_result ) ); 718 //wp_die( print_r( $rc_geo_access_api_result_json ) ); 719 720 } 721 620 722 return $rc_geo_access_api_result; 621 723 } -
rc-geo-access/trunk/readme.txt
r3008230 r3166044 3 3 Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QZEXMAMCYDS3G 4 4 Tags: security, geolocation, login 5 Requires at least: 4.66 Tested up to: 6. 47 Stable tag: 1.4 88 Requires PHP: 7. 35 Requires at least: 5 6 Tested up to: 6.6 7 Stable tag: 1.49 8 Requires PHP: 7.4 9 9 License: GPLv2 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 16 16 17 17 This plugin restricts access to the login page of your WordPress Admin based on the location of the user trying to access it. Restricting access in this way can be a useful way of reducing unwanted login attempts. 18 To get the location of the user the plugin gets the IP address of the user attempting to access the login page and geo-locates their location by using a geolocation API, currently there are t wo services available to use:18 To get the location of the user the plugin gets the IP address of the user attempting to access the login page and geo-locates their location by using a geolocation API, currently there are three options available to use: 19 19 20 20 - IPStack: http://ipstack.com 21 21 - IPGeolocation: https://ipgeolocation.io 22 - OpenLiteSpeed’s local GeoIP variables 22 23 23 Please note: an active API Key is required for either of these this services for the plugin to function correctly. You can register a free account at either of the website addresses above. Please note they offer varying amounts of location API requests for their free and paid plans, it may be necessary to upgrade to a paid plan to provide an increased amount of requests if your site gets a huge amount of login attempts.24 Please note: an active API Key is required for `IPStack` and `IPGeolocation` for the plugin to function correctly. You can register a free account at either of the website addresses above. Please note they offer varying amounts of location API requests for their free and paid plans, it may be necessary to upgrade to a paid plan to provide an increased amount of requests if your site gets a huge amount of login attempts. The `OpenLiteSpeed’s local GeoIP variables` option can be used if you are using OpenLiteSpeed server and have a properly configured geolocation database, more information about configuring that is available here: https://docs.openlitespeed.org/config/advanced/geolocation/#enabling-geolocation 24 25 25 26 26 27 == Example usage: == 27 28 28 Enable the plugin and access the "RC Geo Access" page in the Settings menu in your WordPress Admin to configure the required settings. Note: an active API Key is required for this plugin to function, currently there are two services available to use, you can choose from either 'IPStack' - http://ipstack.com and 'IPGeolocation' - https://ipgeolocation.io as the geolocation providers.29 Enable the plugin and access the "RC Geo Access" page in the Settings menu in your WordPress Admin to configure the required settings. Note: an active API Key is required for this plugin to function, currently there are two external Geolocation services available to use, you can choose from either 'IPStack' - http://ipstack.com and 'IPGeolocation' - https://ipgeolocation.io as the geolocation providers. The `OpenLiteSpeed’s local GeoIP variables` option can be used if you are using OpenLiteSpeed server and have a properly configured geolocation database, more information about configuring that is available here: https://docs.openlitespeed.org/config/advanced/geolocation/#enabling-geolocation 29 30 30 31 … … 48 49 = How does this plugin get the user's location? = 49 50 50 The plugin uses a geolocation API to look up the user's location based on their IP address. Note: an active API Key is required for this plugin to function, currently there are two services available to use, you can choose from either 'IPStack' - http://ipstack.com and 'IPGeolocation' - https://ipgeolocation.io as the geolocation providers.51 The plugin uses a geolocation API to look up the user's location based on their IP address. Note: an active API Key may be required for this plugin to function, currently there are two external services available to use, you can choose from either 'IPStack' - http://ipstack.com and 'IPGeolocation' - https://ipgeolocation.io as the geolocation providers. There is also a third `OpenLiteSpeed’s local GeoIP variables` option which can be used if you are using OpenLiteSpeed server and have a properly configured geolocation database, more information about configuring that is available here: https://docs.openlitespeed.org/config/advanced/geolocation/#enabling-geolocation 51 52 52 53 = Can I use other geolocation APIs? = 53 54 54 No, at this time it is only possible to use either the IPStack.com API or the IPGeolocation.io API.55 No, at this time it is only possible to use either the external providers of IPStack.com or the IPGeolocation.io, or the locally configured OpenLiteSpeed Geolocation functionality. 55 56 56 57 = How do I configure the plugin settings? = … … 60 61 = How can I tell if it is working? = 61 62 62 If you're not seeing any error messages when you are in the plugin settings page then it should hopefully be working correctly. If you've enabled email notifications then at some point you should receive an email when your login page is restricted. There is a way to test it yourself but you need to be very careful! Uncheck your country from the list and save the changes (do not close the browser window or logout from WordPress or you will be locked out of your site - see below for help if that happens!), using another browser or browser tab attempt to access your login page 63 If you're not seeing any error messages when you are in the plugin settings page then it should hopefully be working correctly. If you've enabled email notifications then at some point you should receive an email when your login page is restricted. There is a way to test it yourself but you need to be very careful! Uncheck your country from the list and save the changes (do not close the browser window or logout from WordPress or you will be locked out of your site - see below for help if that happens!), using another browser or browser tab attempt to access your login page. 63 64 64 65 = Help! I've enabled this plugin and now I'm locked out of my site! = … … 66 67 Yikes, sorry! There is a potential danger of this happening if you have enabled the restriction (including the required API key) but you did not set your own country location to be accessible. If this happens then I'm afraid the only option here is to connect to your site directly via SFTP / FTP and remove the plugin files from your site. Once removed you will then be able to login, you can then re-install the plugin, you should then immediately ensure that your current country location is given access in the "RC Geo Access" page in the Settings menu in your WordPress Admin. 67 68 69 = I am using the OpenLiteSpeed Geolocation option but it isn't blocking login access = 70 71 If you are using the OpenLiteSpeed option the IP address of users to your site must be found in the configured Geolocation database in order to establish the user’s country. If the IP address isn't found it will trigger an error message email to be sent which begins with "Sorry, the OpenLiteSpeed GeoIP variables could not be read...". If you receive this error email then you should check that the Geolocation database is configured correctly and also that the database is up to date. 68 72 69 73 == Changelog == 74 75 = 1.49 = 76 77 - Added support for OpenLiteSpeed web server’s local Geolocation functionality, this removes the need for an external third-party geolocation API if you are serving websites using OLS. See more details about how to configure this in OLS here: https://docs.openlitespeed.org/config/advanced/geolocation/#enabling-geolocation 70 78 71 79 = 1.48 =
Note: See TracChangeset
for help on using the changeset viewer.