]> git.ipfire.org Git - ipfire-2.x.git/blobdiff - html/cgi-bin/logs.cgi/showrequestfromcountry.dat
GeoIP: Add lookup function for convenience
[ipfire-2.x.git] / html / cgi-bin / logs.cgi / showrequestfromcountry.dat
index cd97f878075b30de5b32376d3fccdcbb056303cf..605873ac00ce7ca965750582b0264d118aa3cde9 100644 (file)
@@ -13,9 +13,9 @@
 #use CGI::Carp 'fatalsToBrowser';
 
 #use strict;
-use Geo::IP::PurePerl;
 
 require '/var/ipfire/general-functions.pl';
+require "${General::swroot}/geoip-functions.pl";
 require "${General::swroot}/lang.pl";
 require "${General::swroot}/header.pl";
 
@@ -152,7 +152,6 @@ if (!(open (FILE,($filestr =~ /.gz$/ ? "gzip -dc $filestr |" : $filestr)))) {
 my $lines = 0;
 my @log=();
 my $country = $cgiparams{country};
-my $gi = Geo::IP::PurePerl->new();
 
 if (!$skip)
 {
@@ -179,7 +178,7 @@ if (!$skip)
                        }
                        elsif($srcaddr ne '') {
                                # or srcaddr matches country code
-                               my $ccode = $gi->country_code_by_name($srcaddr);
+                               my $ccode = &GeoIP::lookup($srcaddr);
                                if($ccode eq uc($country)){
                                        $log[$lines] = $_;
                                        $lines++;
@@ -233,7 +232,7 @@ if ($multifile) {
 }
 
 &Header::showhttpheaders();
-&Header::openpage($Lang::tr{'firewall log'}, 1, '');
+&Header::openpage($Lang::tr{'firewall log country'}, 1, '');
 &Header::openbigbox('100%', 'left', '', $errormessage);
 
 if ($errormessage) {
@@ -292,7 +291,7 @@ END
 
 &Header::closebox();
 
-&Header::openbox('100%', 'left', $Lang::tr{'firewall log'});
+&Header::openbox('100%', 'left', $Lang::tr{'firewall log country'});
 print "<p><b>$Lang::tr{'firewall hits'} $longmonthstr $daystr: $lines</b></p>";
 
 if ($start == -1) {
@@ -415,6 +414,8 @@ END
 
 &oldernewer();
 
+       print"<table width='100%'><tr><td align='center'><a href='/cgi-bin/logs.cgi/firewalllogcountry.dat'><img src='/images/back.png' alt='$Lang::tr{'back'}' title='$Lang::tr{'back'}' /></a></td></tr></table>";
+
 &Header::closebox();
 
 &Header::closebigbox();