Fix ip detection of geoip
This commit is contained in:
parent
25ee999d27
commit
084516b885
@ -24,6 +24,7 @@
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/dolgeoip.class.php';
|
||||
|
||||
// Security check
|
||||
@ -150,6 +151,25 @@ if ($geoip)
|
||||
if ($result) print $result;
|
||||
else print $langs->trans("Error");
|
||||
*/
|
||||
//var_dump($_SERVER);
|
||||
$ip = $_SERVER['REMOTE_ADDR']?$_SERVER['REMOTE_ADDR']:(($_SERVER['HTTP_X_FORWARDED_FOR']?$_SERVER['HTTP_X_FORWARDED_FOR']:$_SERVER['HTTP_CLIENT_IP']));
|
||||
//$ip='91.161.249.43';
|
||||
$isip=is_ip($ip);
|
||||
if ($isip == 1)
|
||||
{
|
||||
print '<br>'.$ip.' -> ';
|
||||
$result=dol_print_ip($ip,1);
|
||||
if ($result) print $result;
|
||||
else print $langs->trans("Error");
|
||||
}
|
||||
elseif ($isip == 2)
|
||||
{
|
||||
print '<br>'.$ip.' -> ';
|
||||
$result=dol_print_ip($ip,1);
|
||||
if ($result) print $result;
|
||||
else print $langs->trans("NotAPublicIp");
|
||||
}
|
||||
|
||||
$geoip->close();
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user