I. no proxy server is used: REMOTE_ADDR your IPHTTP_VIA has no value or does not show HTTP_X_FORWARDED_FOR has no value or does not show 2. Transparent use
I. no proxy server is used:
REMOTE_ADDR = your IP address
HTTP_VIA = no value or no Display
HTTP_X_FORWARDED_FOR = no value or no Display
II. Transparent Proxy Server: Transparent Proxies
REMOTE_ADDR = IP address of the last proxy server
HTTP_VIA = proxy server IP address
HTTP_X_FORWARDED_FOR = your real IP address. when multiple proxy servers are used, this value is similar to the following: 203.98.1820.3, 203.98.1820.3, 203.129.72.215.
This type of proxy server still forwards your information to your access object, which cannot hide your real identity.
III. general anonymous proxy servers:
REMOTE_ADDR = IP address of the last proxy server
HTTP_VIA = proxy server IP address
HTTP_X_FORWARDED_FOR = proxy server IP address. when multiple proxy servers are used, this value is similar to the following: 203.98.1820.3, 203.98.1820.3, 203.129.72.215.
Your real IP address is hidden, but you are disclosed to the access object that you use the proxy server to access them.
IV. use of fraudulent proxy servers:
REMOTE_ADDR = proxy server IP address
HTTP_VIA = proxy server IP address
HTTP_X_FORWARDED_FOR = random IP address. when multiple proxy servers are used, the value is as follows: 203.98.182.163, 203.98.182.163, 203.129.72.215.
It tells the access object that you used the proxy server, but fabricated a false random IP address instead of your real IP address to cheat it.
5. use of highly anonymous proxy servers:
REMOTE_ADDR = proxy server IP address
HTTP_VIA = no value or no Display
HTTP_X_FORWARDED_FOR = no value or no value is displayed. when multiple proxy servers are used, the value is similar to the following: 203.98.182.163, 203.98.182.163, 203.129.72.215.
The proxy server information replaces all your information, just as you directly access the object using the proxy server.
Example 1: obtain the real IP address of a user,The code is as follows:
- Function getIp (){
- If ($ _ SERVER ['http _ CLIENT_IP ']) {
- $ Ip = $ _ SERVER ['http _ CLIENT_IP ']; // PHP obtains the IP address
- } Elseif ($ _ SERVER ['http _ X_FORWARDED_FOR ']) {
- $ Ip = $ _ SERVER ['http _ X_FORWARDED_FOR '];
- } Else {
- $ Ip = $ _ SERVER ['remote _ ADDR ']; // PHP obtains the IP address
- }
- }
Example 2: The code is as follows:
-
- /*
- Mktime: 2012/9/9
- */
- // Obtain the user's real IP address
- Function get_client_ip (){
- If (getenv ("HTTP_CLIENT_IP") & strcasecmp (getenv ("HTTP_CLIENT_IP"), "unknown "))
- $ Ip = getenv ("HTTP_CLIENT_IP ");
- Else
- If (getenv ("HTTP_X_FORWARDED_FOR") & strcasecmp (getenv ("HTTP_X_FORWARDED_FOR"), "unknown "))
- $ Ip = getenv ("HTTP_X_FORWARDED_FOR ");
- Else
- If (getenv ("REMOTE_ADDR") & strcasecmp (getenv ("REMOTE_ADDR"), "unknown "))
- $ Ip = getenv ("REMOTE_ADDR ");
- Else
- If (isset ($ _ SERVER ['remote _ ADDR ']) & $ _ SERVER ['remote _ ADDR '] & strcasecmp ($ _ SERVER ['remote _ ADDR'], "unknown "))
- $ Ip = $ _ SERVER ['remote _ ADDR '];
- Else
- $ Ip = "unknown ";
- Return ($ ip );
- }
- Echo $ ip = get_client_ip (); // This is your ip address.
- ?>