This repository has been archived by the owner on Feb 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SQL Update and browser side working GeoIP DB downloader working.
- Loading branch information
Showing
4 changed files
with
795 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
if (!is_writeable(".")) { | ||
die("Error! The folder includes/geoip must be chmod 0777 (Writable by all)"); | ||
} | ||
|
||
//ini_set('display_errors', '1'); | ||
//error_reporting(E_ALL); | ||
|
||
function gzfile_get_contents ($filename, $use_include_path=0){ | ||
$file = @gzopen($filename, 'rb', $use_include_path) or die("failed gzopen"); | ||
if ($file) { | ||
$data = ''; | ||
while (!gzeof($file)) { | ||
$data .= gzread($file, 1024); | ||
} | ||
gzclose($file); | ||
return $data; | ||
} | ||
} | ||
|
||
$countryDbIPv6 = "http://geolite.maxmind.com/download/geoip/database/GeoIPv6.dat.gz"; | ||
|
||
echo "Downloading Maxmind GeoIP Lite Country database\n<br /><br />\n\n"; | ||
$dbipv6 = file_get_contents($countryDbIPv6) or die("Error downloading IPv6 Database. Exiting\n"); | ||
file_put_contents("geo-ipv6.dat.gz", $dbipv6) or die("Error writing gzfile."); | ||
echo "Downloaded IPv6 Database.\n<br />\n"; | ||
|
||
$datipv6 = gzfile_get_contents("geo-ipv6.dat.gz", 0) or die("Error extracting IPv6 Database. Exiting\n"); | ||
file_put_contents("geo-ipv6.dat", $datipv6) or die("Error writing dat file."); | ||
echo "Extracted IPv6 Database.\n<br />\n"; | ||
|
||
|
||
|
||
?> |
Oops, something went wrong.