diff --git a/cookiecontrol.admin.inc b/cookiecontrol.admin.inc
index 5d9c345..2cd4931 100644
--- a/cookiecontrol.admin.inc
+++ b/cookiecontrol.admin.inc
@@ -150,6 +150,13 @@ function cookiecontrol_admin_settings() {
     '#default_value' => variable_get('cookiecontrol_exclude_paths', ''),
     '#description' => t('Specify pages, on which to not display the cookie control, by using their paths. Enter one path per line. The \'*\' character is a wildcard. Example paths are blog for the blog page and blog/* for every personal blog. %front is the front page.', array('%front' => '<front>')),
   );
+  $form['advanced']['cookiecontrol_use_geoip'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Use geoip support'),
+    '#default_value' => variable_get('cookiecontrol_use_geoip', FALSE),
+    '#description' => t('Use the geoip module for third party library support instead of the default one. GeoIP module must be enabled for this option.'),
+    '#disabled' => !module_exists('geoip'),
+  );
 
   return system_settings_form($form);
 }
diff --git a/cookiecontrol.module b/cookiecontrol.module
index 190a32a..44e0f76 100644
--- a/cookiecontrol.module
+++ b/cookiecontrol.module
@@ -262,14 +262,26 @@ function cookiecontrol_userinrestrictedcountry() {
     return TRUE;
   }
 
-  $request = drupal_http_request('http://www.geoplugin.net/php.gp?ip=' . ip_address());
-    
-  // Ensure a valid response was received
-  if ($request->code == 200) {
-    $geo_info = unserialize($request->data);
-    return stripos($cookiecontrol_countries, $geo_info['geoplugin_countryName']) !== FALSE ? TRUE : FALSE;
-  } else {
-    watchdog('Cookie Control', 'A visitors IP address could not be matched to a location so they were not blocked from logging in. Geoplugin returned the error [@code] @message', array('@code' => $request->code, '@message' => $request->status_message), WATCHDOG_ERROR);
-    return TRUE;
+  $ip = ip_address();
+
+  $cookiecontrol_countries = variable_get('cookiecontrol_countries', '');
+
+  if (variable_get('cookiecontrol_use_geoip', FALSE)) {
+    $cc = geoip_country_code($ip);
+    $countries = geoip_country_values();
+    return stripos($cookiecontrol_countries, $countries[$cc]) !== FALSE ? TRUE : FALSE;
   }
-}
\ No newline at end of file
+  else {
+    $request = drupal_http_request('http://www.geoplugin.net/php.gp?ip=' . $ip);
+
+    // Ensure a valid response was received
+    if ($request->code == 200) {
+      $geo_info = unserialize($request->data);
+      return stripos($cookiecontrol_countries, $geo_info['geoplugin_countryName']) !== FALSE ? TRUE : FALSE;
+    }
+    else {
+      watchdog('Cookie Control', 'A visitors IP address could not be matched to a location so they were not blocked from logging in. Geoplugin returned the error [@code] @message', array('@code' => $request->code, '@message' => $request->status_message), WATCHDOG_ERROR);
+      return TRUE;
+    }
+  }
+}
