diff options
author | Romain d'Alverny <rda@mageia.org> | 2012-02-21 22:57:00 +0000 |
---|---|---|
committer | Romain d'Alverny <rda@mageia.org> | 2012-02-21 22:57:00 +0000 |
commit | 9b749e073b46d43414106ca261d98ae01b9c0820 (patch) | |
tree | ee64f9fe0e10a8c1b58e8cf1529956aa3ba46ce2 /en/downloads/debug | |
parent | c6a5926b55996f374169f1220054e6ff5bbdd9b0 (diff) | |
download | www-9b749e073b46d43414106ca261d98ae01b9c0820.tar www-9b749e073b46d43414106ca261d98ae01b9c0820.tar.gz www-9b749e073b46d43414106ca261d98ae01b9c0820.tar.bz2 www-9b749e073b46d43414106ca261d98ae01b9c0820.tar.xz www-9b749e073b46d43414106ca261d98ae01b9c0820.zip |
updated tests
Diffstat (limited to 'en/downloads/debug')
-rw-r--r-- | en/downloads/debug/index.php | 48 |
1 files changed, 34 insertions, 14 deletions
diff --git a/en/downloads/debug/index.php b/en/downloads/debug/index.php index caca93827..015488c5d 100644 --- a/en/downloads/debug/index.php +++ b/en/downloads/debug/index.php @@ -1,5 +1,6 @@ <?php + $ips = array(); $functions = array( 'geoip_country_code_by_name', @@ -18,30 +19,49 @@ else echo '<html><body>'; +echo '<h3>IP addresses</h3>'; +print_r($ips); + echo '<h3>testing geoip PHP functions:</h3>'; echo '<ul>'; foreach ($functions as $f) { echo sprintf('<li>%s: %s available</li>', $f, function_exists($f) ? 'is' : 'is not'); } -echo '<li>DB version: ', geoip_database_info(), '</li>'; - echo '</ul>'; -echo '<h3>using geoip PHP module</h3>'; -foreach ($ips as $label => $ip) { - echo ' * ', $label, ': ', $ip, ' => '; - echo geoip_country_code_by_name($ip), ', '; - echo geoip_continent_code_by_name($ip), ', '; - echo geoip_record_by_name($ip), ', '; - echo geoip_id_by_name($ip), ', '; // GEOIP_UNKNOWN_SPEED GEOIP_DIALUP_SPEED GEOIP_CABLEDSL_SPEED GEOIP_CORPORATE_SPEED - echo geoip_isp_by_name($ip), ', '; - echo geoip_org_by_name($ip), ', '; - echo implode(', ', geoip_record_by_name($ip)); - echo "\n"; +if (function_exists('geoip_country_code_by_name')) { + + echo '<h3>using geoip PHP module</h3>', "\n"; + echo 'DB version: ', geoip_database_info(); + echo '<ul>'; + foreach ($ips as $label => $ip) { + echo '<li>', $label, ': ', $ip, ' => '; + echo geoip_country_code_by_name($ip), ', '; + echo geoip_continent_code_by_name($ip), ', '; + echo geoip_record_by_name($ip), ', '; + echo geoip_id_by_name($ip), ', '; // GEOIP_UNKNOWN_SPEED GEOIP_DIALUP_SPEED GEOIP_CABLEDSL_SPEED GEOIP_CORPORATE_SPEED + echo geoip_isp_by_name($ip), ', '; + echo geoip_org_by_name($ip), ', '; + echo implode(', ', geoip_record_by_name($ip)); + echo '</li>'; + } + echo '</ul>'; } echo '<h3>using mod_geoip</h3>'; echo 'Country: ', apache_note("GEOIP_COUNTRY_CODE"), '<br>'; echo 'Country name: ', apache_note("GEOIP_COUNTRY_NAME"), '<br>'; -echo '----</pre></body></html>'; +echo '<h3>using mga wrapper around MaxMind library</h3>'; +include realpath(__DIR__ . '/../../../lib/mga_geoip.php'); + +echo '<ul>'; +foreach ($ips as $label => $ip) { + $country = mga_geoip_country_by_ip($ip); + $C = mga_geoip_continent_by_country($country); + echo '<li>', $label, ': ', $ip, ' => ', $country, ', ', $C, '</li>'; +} +echo '</ul>'; + + +echo '<hr></body></html>'; |