diff --git a/htdocs/admin/geoipmaxmind.php b/htdocs/admin/geoipmaxmind.php
index 0a118dfe065..6b8fe0ab3b7 100644
--- a/htdocs/admin/geoipmaxmind.php
+++ b/htdocs/admin/geoipmaxmind.php
@@ -47,7 +47,12 @@ if ($action == 'set')
$gimcdf = GETPOST("GEOIPMAXMIND_COUNTRY_DATAFILE");
- if (!$gimcdf && !file_exists($gimcdf))
+ if (!$error && $gimcdf && ! preg_match('/\.(dat|mmdb)$/', $gimcdf)) {
+ setEventMessages($langs->trans("ErrorFileMustHaveFormat", '.dat|.mmdb'), null, 'errors');
+ $error++;
+ }
+
+ if (!$error && $gimcdf && !file_exists($gimcdf))
{
setEventMessages($langs->trans("ErrorFileNotFound", $gimcdf), null, 'errors');
$error++;
@@ -126,7 +131,7 @@ if ($conf->global->GEOIP_VERSION == 'php')
{
print 'Using geoip PHP internal functions. Value must be '.geoip_db_filename(GEOIP_COUNTRY_EDITION).' or '.geoip_db_filename(GEOIP_CITY_EDITION_REV1).' or /pathtodatafile/GeoLite2-Country.mmdb
';
}
-print '';
+print '';
print '';
print '';
@@ -148,7 +153,7 @@ print $langs->trans("YouCanDownloadAdvancedDatFileTo", '
';
- print '
'.$langs->trans("TestGeoIPResult", $ip).':';
+ print '
'.$langs->trans("TestGeoIPResult", $ip).':';
$ip = '24.24.24.24';
print '
'.$ip.' -> ';