<ol
class
=
"dp-xml"
>
<li
class
=
"alt"
><span><span>
function
getip(){ </span></span></li>
<li><span>
if
(
getenv
(
"http_client_ip"
) <br>&&
strcasecmp
(
getenv
(
"http_client_ip"
),
"unknown"
)) </span></li>
<li
class
=
"alt"
>
<span>$</span><span
class
=
"attribute"
>ip</span><span> = </span><span
class
=
"attribute-value"
>
getenv
</span><span>(
"http_client_ip"
); </span>
</li>
<li><span>
else
if
(
getenv
(
"http_x_forwarded_for"
) <br>&&
strcasecmp
(
getenv
(
"http_x_forwarded_for"
),
"unknown"
)) </span></li>
<li
class
=
"alt"
>
<span>$</span><span
class
=
"attribute"
>ip</span><span> = </span><span
class
=
"attribute-value"
>
getenv
</span><span>(
"http_x_forwarded_for"
); </span>
</li>
<li><span>
else
if
(
getenv
(
"remote_addr"
)<br> &&
strcasecmp
(
getenv
(
"remote_addr"
),
"unknown"
)) </span></li>
<li
class
=
"alt"
>
<span>$</span><span
class
=
"attribute"
>ip</span><span> = </span><span
class
=
"attribute-value"
>
getenv
</span><span>(
"remote_addr"
); </span>
</li>
<li><span>
else
if
(isset(
$_server
[@#remote_addr@#])<br> &&
$_server
[@#remote_addr@#] <br>&&
strcasecmp
(
$_server
[@#remote_addr@#],
"unknown"
)) </span></li>
<li
class
=
"alt"
>
<span>$</span><span
class
=
"attribute"
>ip</span><span> =
$_server
[@#remote_addr@#]; </span>
</li>
<li><span>
else
</span></li>
<li
class
=
"alt"
>
<span>$</span><span
class
=
"attribute"
>ip</span><span> = </span><span
class
=
"attribute-value"
>
"unknown"
</span><span>; </span>
</li>
<li><span>
return
(
$ip
); </span></li>
<li
class
=
"alt"
><span>} </span></li>
</ol>