Page is a not externally linkable
- Code, Content, and Presentation
-- PHP Server Side Scripting
---- How do I get a user's IP address?


penders - 12:22 am on Jan 18, 2012 (gmt 0)


<?php 
$ip=$REMOTE_ADDR;
echo $ip;
?>


Just to add, this should not be used (referencing $REMOTE_ADDR in the global scope) - this is reliant on register_globals being set on the server and it probably isn't - or shouldn't be!

You could examine all the superglobals (or the output from phpinfo() [uk.php.net]) to see if you can see your IP address!


Thread source:: http://www.webmasterworld.com/php/4407841.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com