Proxy Server (Proxy Server) is an important server security function. It works mainly at the session layer of the Open System Interconnection (OSI) model , thus acting as a firewall. role. Proxy servers are mostly used to connect to the INTERNET (International Internet) and Local Area Network (LAN).
Proxy (English: Proxy), also known as network proxy, is a special network service that allows a network terminal (usually a client) to communicate with another network terminal (usually a server) through this service Indirect connection. Some network devices such as gateways and routers have network proxy functions. It is generally believed that proxy services are helpful to protect the privacy or security of network terminals and prevent attacks
The following code can detect most IPs accessed through the proxy server.
<?php //beiji.com 2000.6.17 $ip = getenv("REMOTE_ADDR"); $v = getenv("HTTP_VIA"); $f = getenv("HTTP_X_FORWARDED_FOR"); $c = getenv("HTTP_XROXY_CONNECTION"); $o = getenv("HTTP_PRAGMA"); print '<br>REMOTE_ADDR'; print $ip; if (($v=="")&&($f=="")&&($c=="")&&($o=="")){ print "<br>not through proxy"; } else { print "<br>through proxy"; print '<br>http_via: ';print $v; print '<br>http_x_forwarded_for: ';print $f; print '<br>http_xroxy_connection: ';print $c; print '<br>http_pragma: ';print $o; } ?>
The above is the detailed content of php detect proxy instance code. For more information, please follow other related articles on the PHP Chinese website!