]> git.ipfire.org Git - thirdparty/AWStats.git/commitdiff
Fix: geoip_city was sometimes bind.
authoreldy <>
Tue, 7 Dec 2004 13:11:55 +0000 (13:11 +0000)
committereldy <>
Tue, 7 Dec 2004 13:11:55 +0000 (13:11 +0000)
wwwroot/cgi-bin/plugins/geoip_city_maxmind.pm

index cb8d78389e1f0e99f1071ba2408c00bde8b91537..d8ce1eb7701acc6767a963559d4f34dd15898902 100755 (executable)
@@ -367,6 +367,31 @@ sub SectionProcessIp_geoip_city_maxmind {
 }
 
 
+#-----------------------------------------------------------------------------
+# PLUGIN FUNCTION: SectionProcessHostname_pluginname
+# UNIQUE: NO (Several plugins using this function can be loaded)
+#-----------------------------------------------------------------------------
+sub SectionProcessHostname_geoip_city_maxmind {
+    my $param="$_[0]";      # Param must be an IP
+       # <-----
+       my $record=();
+       $record=$geoip_city_maxmind->record_by_name($param) if $geoip_city_maxmind;
+       if ($Debug) { debug("  Plugin geoip_city_maxmind: GetCityByName for $param: [$record]",5); }
+    my $city=$record->city;
+#      if ($PageBool) { $_city_p{$city}++; }
+    if ($city) {
+        my $countrycity=lc(($record->country_code)."_".$city);
+        $countrycity=~tr/ /_/;
+        $_city_h{$countrycity}++;
+    } else {
+        $_city_h{'unknown'}++;
+    }
+#      if ($timerecord > $_city_l{$city}) { $_city_l{$city}=$timerecord; }
+       # ----->
+       return;
+}
+
+
 #-----------------------------------------------------------------------------
 # PLUGIN FUNCTION: SectionReadHistory_pluginname
 # UNIQUE: NO (Several plugins using this function can be loaded)