IP address and proxy - php script

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I am currently using getenv(REMOTE_ADDR) to get the IP address. I don't know
much about proxies. Is this script giving a more accurate IP?

    if (getenv(HTTP_X_FORWARDED_FOR)) {
        $ipaddress = getenv(HTTP_X_FORWARDED_FOR);
    } else {
        $ipaddress = getenv(REMOTE_ADDR);

Re: IP address and proxy - php script

<Richard> wrote:
Quoted text here. Click to load it

As I recall, the X-Forwarded-For header may contain a list of proxies,
some of which may lie within private IP address space.  Also, that
header can be easily faked.  You need to carefully evaluate how you
are using that information.

gds at best dot com

Site Timeline