Reply to Re: php script for host IP address

Your name:

Reply:


Posted by Fred Atkinson on 09/25/05 04:07

On Tue, 20 Sep 2005 21:38:26 +0200, "Sander" <sander@cartel.nl> wrote:

>
>"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
>

Also, if I wanted to display the subnet mask, is there a way
to do that?


Fred

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация