Forum Moderators: DixonJones

Message Too Old, No Replies

Detecting Proxies in PHP

I need to give them a cookie...

         

iJeep

9:01 pm on Mar 6, 2003 (gmt 0)

10+ Year Member



I tried using the search, but everything came up 404...bummer

I have recently discovered (the hard way) that AOL uses a proxy server and that my visitors IP address would change during the same session which was a headache for them seeing that their shopping cart contents and somebody else's were there.

I got the AOLers redirected to get a cookie to track them and it works.

How can I tell in general if somebody is behind a proxy (or anything else) that will cause these type of problems?

Dreamquick

9:25 pm on Mar 6, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Unfortunately you can't reliably sniff out proxies and IMO using IP as a unique identifier for users is not an advisable route, look at using session cookies instead.

On a more helpful note (I've been there too and really dislike proxies), the give-aways for proxies are all in the request header;

via:
forwarded:
x-forwarded-for:
client-ip:

If it's an option you could also search for pxy or proxy in the client's hostname.

(there may be others, try googling for each of those & proxy to see what you can turn up)

However you can't be guaranteed that the proxy isn't anonomous (meaning that it doesn't disclose the fact that it's a proxy) and as such it will neatly bypass your tests.

- Tony