Posted by Sander on 09/20/05 22:38
"Fred Atkinson" <fatkinson@mishmash.com> schreef in bericht
news:3rl0j1tksltv29vbsll4uoi0c495b78f3o@4ax.com...
> <?php
> echo "Current IP Address: ";
> $ipx = getenv("HTTP_CLIENT_IP") ? getenv("HTTP_CLIENT_IP") : 0
> ;
> $ipx = !$ipx && getenv("HTTP_X_FORWARDED_FOR") ?
> getenv("HTTP_X_FORWARDED_FOR") : 0 ;
> $ipx = !$ipx && getenv("REMOTE_ADDR") ? getenv("REMOTE_ADDR") :
> 0 ;
> echo !$ipx ? "UNKNOWN" : $ipx;
> ?>
>
> I want to modify it to return the host address of the server
> it is running on.
Do you mean this:
<?php
echo "Current IP Address: ";
$ipx = getenv("HTTP_CLIENT_IP") ? getenv("HTTP_CLIENT_IP") : 0;
$ipx = !$ipx && getenv("HTTP_X_FORWARDED_FOR") ?
getenv("HTTP_X_FORWARDED_FOR") : 0 ;
$ipx = !$ipx && getenv("REMOTE_ADDR") ? getenv("REMOTE_ADDR") : 0 ;
echo !$ipx ? "UNKNOWN" : $ipx;
echo "<br>";
echo "Server IP Address: ";
$ipx = getenv("SERVER_ADDR") ? getenv("SERVER_ADDR") : 0;
echo !$ipx ? "UNKNOWN" : $ipx;
?>
Sander Swuste
[Back to original message]
|