/ Published in: PHP
Code is meant to show the real ip address, in case if user is using a proxy. Most of the time $_SERVER["REMOTE_ADDR"] do not work correctly due to the proxy setting of user. It's a nice solution.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php { //check for ip from share internet $ip = $_SERVER["HTTP_CLIENT_IP"]; } { // Check for the Proxy User $ip = $_SERVER["HTTP_X_FORWARDED_FOR"]; } else { $ip = $_SERVER["REMOTE_ADDR"]; } // This will print user's real IP Address // does't matter if user using proxy or not. echo $ip; ?>
URL: http://topgravity.com/find-my-ip-address/