Hi everybody,
I'm using a function to get my site's users' IP addresses, and its working fine, but one of my users when he logged in, it wrote to the database that the IP address is "unknown"!!!! very wiered!!! Why?
This is the function Im using:
Function GetUserIPAddress()
{
$a = getenv("HTTP_X_FORWARDED_FOR"
;
$b = getenv("REMOTE_ADDR"
;
if ($a <> ""
{
$posn=0;
do
{
$posn++;
if ($a{$posn} == ',')
{
break;
}
} while ($posn < strlen($a));
$login_ip = substr($a,0,$posn);
} // end [if ($a <> ""
]
else
{
$login_ip = $b;
}
$login_ip = $login_ip;
return ($login_ip);
}
Is there is anything missing? or can it be more strong?
Please help.
I'm using a function to get my site's users' IP addresses, and its working fine, but one of my users when he logged in, it wrote to the database that the IP address is "unknown"!!!! very wiered!!! Why?
This is the function Im using:
Function GetUserIPAddress()
{
$a = getenv("HTTP_X_FORWARDED_FOR"
$b = getenv("REMOTE_ADDR"
if ($a <> ""
{
$posn=0;
do
{
$posn++;
if ($a{$posn} == ',')
{
break;
}
} while ($posn < strlen($a));
$login_ip = substr($a,0,$posn);
} // end [if ($a <> ""
else
{
$login_ip = $b;
}
$login_ip = $login_ip;
return ($login_ip);
}
Is there is anything missing? or can it be more strong?
Please help.