Once you start building any complex site and needs to log a users IP address you will need this neat little piece of code. Its easy to remember and easy to use. Great for logging visitor events (for example posts to a message board!).

If register globals is on
$ip=@$REMOTE_ADDR;
The above will save your ip address to a variable called $ip. Simple eh?

If register globals is off
$ip=$_SERVER['REMOTE_ADDR'];
SIMPLE!

Posted by OLLIE at 20:36pm

No comments yet. Be the first to add one!


Leave a Reply