[mapguide-trac] #539: Implement CLIENTIP and CLIENTAGENT
tracking in the Server's Access.log
MapGuide Open Source
trac_mapguide at osgeo.org
Mon May 5 21:01:08 EDT 2008
#539: Implement CLIENTIP and CLIENTAGENT tracking in the Server's Access.log
----------------------+-----------------------------------------------------
Reporter: tonyfang | Owner: tonyfang
Type: defect | Status: reopened
Priority: medium | Milestone: 2.1
Component: Web API | Version: 2.0.0
Severity: minor | Resolution:
Keywords: | External_id:
----------------------+-----------------------------------------------------
Changes (by tonyfang):
* status: closed => reopened
* resolution: fixed =>
Comment:
Jason: Thanks for the tip!
I looked a little more into HTTP_CLIENT_IP and XFF -- that seems much
better than simply using REMOTE_ADDR. So the code will be changed to the
following:
{{{
function GetClientIp()
{
$clientIp = '';
if (array_key_exists('HTTP_CLIENT_IP', $_SERVER)
&& strcasecmp($_SERVER['HTTP_CLIENT_IP'], 'unknown') != 0)
{
$clientIp = $_SERVER['HTTP_CLIENT_IP'];
}
else if (array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER)
&& strcasecmp($_SERVER['HTTP_X_FORWARDED_FOR'], 'unknown') != 0)
{
$clientIp = $_SERVER['HTTP_X_FORWARDED_FOR'];
}
else if (array_key_exists('REMOTE_ADDR', $_SERVER))
{
$clientIp = $_SERVER['REMOTE_ADDR'];
}
return $clientIp;
}
}}}
--
Ticket URL: <https://trac.osgeo.org/mapguide/ticket/539#comment:6>
MapGuide Open Source <http://mapguide.osgeo.org/>
MapGuide Open Source Internals
More information about the mapguide-trac
mailing list