From: Peter Müller Date: Wed, 15 Nov 2017 21:56:36 +0000 (+0100) Subject: display GeoIP information on ipinfo.cgi X-Git-Tag: v2.19-core117~1^2~12 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9b5a17bf949c3b97f3fa65a01642f5f78a6ababc;p=people%2Fstevee%2Fipfire-2.x.git display GeoIP information on ipinfo.cgi Display GeoIP information on ipinfo.cgi and use newly implemented function in /var/ipfire/geoip-functions.pl . Signed-off-by: Peter Müller Signed-off-by: Michael Tremer --- diff --git a/html/cgi-bin/ipinfo.cgi b/html/cgi-bin/ipinfo.cgi index 16541f1262..b756a24d2a 100644 --- a/html/cgi-bin/ipinfo.cgi +++ b/html/cgi-bin/ipinfo.cgi @@ -30,6 +30,7 @@ use strict; require '/var/ipfire/general-functions.pl'; require "${General::swroot}/lang.pl"; require "${General::swroot}/header.pl"; +require "${General::swroot}/geoip-functions.pl"; my %cgiparams=(); @@ -50,6 +51,10 @@ if (&General::validip($addr)) { my $hostname = gethostbyaddr($iaddr, AF_INET); if (!$hostname) { $hostname = $Lang::tr{'lookup failed'}; } + # enumerate GeoIP information for IP address... + my $ccode = &GeoIP::lookup($addr); + my $flag_icon = &GeoIP::get_flag_icon($ccode); + my $sock = new IO::Socket::INET ( PeerAddr => $whoisname, PeerPort => 43, Proto => 'tcp'); if ($sock) { @@ -81,7 +86,7 @@ if (&General::validip($addr)) { @lines = ( "$Lang::tr{'unable to contact'} $whoisname" ); } - &Header::openbox('100%', 'left', $addr . ' (' . $hostname . ') : '.$whoisname); + &Header::openbox('100%', 'left', $addr . " $ccode (" . $hostname . ') : '.$whoisname); print "
\n";
 	foreach my $line (@lines) {
 		print &Header::cleanhtml($line,"y");