[ciapug] php SuperGlobals issue
Ron Mutchler, ZCE
qsecofr at gmail.com
Tue Mar 7 10:07:23 CST 2006
I've used REMOTE_ADDR in my scripts before without seeing what you are
explaining.
function get_ipaddy() {
$ipaddy = getenv ("REMOTE_ADDR");
return $ipaddy;
}
Have you tried looking at phpinfo to see what it says?
If you are hosting with a company, they could have configured it not
to return that particular variable. I have a host that refuses to
return PATH_INFO. I ended up having to look at ORIG_PATH_INFO in that
case.
On 3/7/06, vanish at dreamscapevisionery.com
<vanish at dreamscapevisionery.com> wrote:
> I'm hoping someone out there can figure out how I've screwed this up...
>
> In an include file, I have the following code:
>
> $sec_ip = $_SERVER['REMOTE_ADDR'];
>
> Which should set the variable to the IP address of the visitor's PC. In my
> setup, however, it displays the server's IP instead. I tried replacing that
> with:
>
> $sec_ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
>
> to see if the problem was a proxy issue, but alas no ip is shown. (Yes, I tried
> the getenv method as well and the $ENV method also. All return the same result)
>
> Setting the variable form the original code page has the same effect so it's not
> some funky problem caused by being in an include file.
>
> Any ideas? Anyone? Bueller? Bueller?
>
> Chris VC
> _______________________________________________
> ciapug mailing list
> ciapug at cialug.org
> http://cialug.org/mailman/listinfo/ciapug
>
More information about the ciapug
mailing list