Server IP : 85.193.89.191 / Your IP : 13.59.58.18 Web Server : Apache System : Linux 956367-cx40159.tmweb.ru 3.10.0-1160.105.1.el7.x86_64 #1 SMP Thu Dec 7 15:39:45 UTC 2023 x86_64 User : bitrix ( 600) PHP Version : 8.1.27 Disable Function : NONE MySQL : OFF | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /proc/978/cwd/usr/share/doc/GeoIP-1.5.0/ |
Upload File : |
#!/usr/bin/perl use strict; use warnings; use POSIX; use LWP::Simple; use File::Copy; use Carp; my $ipdb = "GeoLiteCity.dat"; my $datadir = "/usr/share/GeoIP/"; my $fullpath = $datadir . $ipdb; my $url = "http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz"; my $date = strftime "%Y%m%d", localtime; # Do we have an existing IP database? if ( -e $fullpath ) { print "Fetching " . $ipdb . " from " . $url . "\r\n"; if ( is_success( getstore( $url, $datadir . "GeoLiteCity.dat.gz" ) ) ) { move( $fullpath, $datadir . $ipdb . "." . $date ) || croak "Can't move the old database aside\r\n"; system( 'gzip', '-d', $datadir . 'GeoLiteCity.dat.gz' ); if ( $? ne 0 ) { croak "Could not uncompress database - exited $?\r\n"; } print "GeoIP database updated. Old copy is at " . $ipdb . "." . $date . "\r\n"; } else { croak "Fetch failed - try again later?\r\n"; } } else { croak "You don't appear to have a valid GeoIP database installed..\r\n"; }