Re: Question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/7/05, Sven Simons <sven.simons@xxxxxxx> wrote:
>
> I've installed PHP using the windows installer
> I try to open then php pages containing the following script :
> <?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;
> ?>
> It works and gives me a correct current IP address
>
> When manually installing PHP it always gives me the status UNKNOWN.
>
>
Just use the $_SERVER[] superglobal array to grab the stuff you need. Don't
use the getenv function.
 -Mike

--
________________________________
Michael E. Crute
Software Developer
SoftGroup Development Corporation

Linux, because reboots are for installing hardware.
"In a world without walls and fences, who needs windows and gates?"

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux