From 3a27060503b18815f7eb268bbce3df4c124aa24e Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Sun, 18 Aug 2013 01:06:13 +1000 Subject: [PATCH] GeoIP: Ignore country codes that aren't country codes: ap (Asia/Pacific), EU, etc. --- post.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/post.php b/post.php index 49f569f4..3f8656df 100644 --- a/post.php +++ b/post.php @@ -430,8 +430,9 @@ if (isset($_POST['delete'])) { error('GeoIP not available: ' . geoip_db_filename(GEOIP_COUNTRY_EDITION)); } if ($country_code = @geoip_country_code_by_name($_SERVER['REMOTE_ADDR'])) { - $post['body'] .= "\n" . strtolower($country_code) . "" . - "\n" . @geoip_country_name_by_name($_SERVER['REMOTE_ADDR']) . ""; + if (!in_array(strtolower($country_code), array('eu', 'ap', 'o1', 'a1', 'a2'))) + $post['body'] .= "\n" . strtolower($country_code) . "" . + "\n" . @geoip_country_name_by_name($_SERVER['REMOTE_ADDR']) . ""; } }