aboutsummaryrefslogtreecommitdiffstats
path: root/en/downloads/debug/index.php
blob: c93ddfaeba2502e79bbcf48a0c4849ab116b4005 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php

$ips = array();
$functions = array(
    'geoip_country_code_by_name',
    'geoip_continent_code_by_name'
);

if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])
    && $str = $_SERVER['HTTP_X_FORWARDED_FOR'])
{
    $arr = explode(', ', $str);
    $ips['ip'] = $arr[0];
    $ips['gw'] = $_SERVER['REMOTE_ADDR'];
}
else
    $ips['ip'] = $_SERVER['REMOTE_ADDR'];

echo '<html><body>';

echo '<h3>Testing functions:</h3>';
echo '<ul>';
foreach ($functions as $f) {
    echo sprintf('<li>%s: %s available</li>',
        $f, function_exists($f) ? 'is' : 'is not');
}
echo '</ul>';

echo '<h3>Testing IP, country, continent</h3>';
foreach ($ips as $label => $ip) {
    echo ' * ', $label, ': ', $ip, ' => ';
    echo geoip_country_code_by_name($ip), ', ';
    echo geoip_continent_code_by_name($ip), "\n";
}

echo '----</pre></body></html>';