Home > Article > Backend Development > PHP example sharing to determine whether the client uses a proxy server and its anonymity level_PHP tutorial
To determine whether the client uses a proxy server, you can judge from the environment variable information sent by the client.
Specifically, look at the HTTP_VIA field. If this field is set, it means that the client uses a proxy server.
The level of anonymity can be determined by referring to the table below.
Given an application example, you can hang up a proxy and try the effect: http://ip.mixsec.org/
1. When not using a proxy server:
REMOTE_ADDR = Your IP
HTTP_VIA = No value or not displayed
HTTP_X_FORWARDED_FOR = No value or not displayed
2. The use of transparent proxy servers: Transparent Proxies
REMOTE_ADDR = Proxy server IP
HTTP_VIA = Proxy server IP (Supplement: This field is filled in by the proxy server, and sometimes gateway information, etc.)
HTTP_X_FORWARDED_FOR = Your real IP
This type of proxy server is still Forwarding your information to the person you visit cannot achieve the purpose of hiding your true identity.
3. The situation of using ordinary anonymous proxy servers: Anonymous Proxies
REMOTE_ADDR = Proxy server IP
HTTP_VIA = Proxy server IP (Supplement: This field is filled in by the proxy server, and sometimes gateway information, etc.)
HTTP_X_FORWARDED_FOR = Proxy server IP
Hide your real IP, but reveal to the visitors that you use a proxy server to access them.
4. The use of deceptive proxy servers: Distorting Proxies
REMOTE_ADDR = Proxy server IP
HTTP_VIA = Proxy server IP (Supplement: This field is filled in by the proxy server, and sometimes gateway information, etc.)
HTTP_X_FORWARDED_FOR = Random IP
Tell the visitor that you are using a proxy server, but make up a fake random IP to replace your real IP to deceive it.
5. Situation of using high anonymity proxy server: High Anonymity Proxies
REMOTE_ADDR = Proxy server IP
HTTP_VIA = No value or no display
HTTP_X_FORWARDED_FOR = No value or no display
Use proxy completely The server's information replaces all your information, as if you were using that proxy server to directly access the object.
In addition, proxy judges can be used to summarize some other reference judgment information and use it in practice.
Finally write a php example for your reference only:
http://www.bkjia.com/PHPjc/779567.html