jwk811 Posted October 26, 2006 Share Posted October 26, 2006 How can you catch someones IP address when they're veiwing a page? Quote Link to comment Share on other sites More sharing options...
php_joe Posted October 26, 2006 Share Posted October 26, 2006 use:[b]$IP = $_SERVER['REMOTE_ADDR'];[/b]Joe Quote Link to comment Share on other sites More sharing options...
.josh Posted October 26, 2006 Share Posted October 26, 2006 FYI, that's not 100% reliable. people can hide their ip address or change it. Quote Link to comment Share on other sites More sharing options...
php_joe Posted October 26, 2006 Share Posted October 26, 2006 Aside from death, what is 100% reliable? ;) Quote Link to comment Share on other sites More sharing options...
.josh Posted October 26, 2006 Share Posted October 26, 2006 getting taxed. Quote Link to comment Share on other sites More sharing options...
xsist10 Posted October 26, 2006 Share Posted October 26, 2006 The closest I've come to 100% (call it 86.563%)[code]<?phppublic function getValidIP() { 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);}?>[/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.