Easy IP find

By log2 on Dec 20, 2004

All this does is show the person on the site what their IP address is, it's not extremely useful, but it's extremely easy and comes in handy if you're logging each visitor! you can tell them their IP address and then tell them their being logged, that's just a security feature to not get hacked, or at least try to scare them off.

<?php
$ip = $_SERVER['REMOTE_ADDR'];
echo "Your IP address is as follows: " . $ip;
?>

Comments

Sign in to comment.
nancyjsf   -  Sep 15, 2010

this isn't working. i need to get users LAN IP address. is that possible?

 Respond  
Demian Saber   -  Feb 28, 2010

this is smaller :) :
<?=$_SERVER['REMOTE_ADDR'];

  • with special php.ini config
 Respond  
FacELTi   -  Jul 19, 2005

you could make the code smaller like:
<?
echo $_SERVER[\'REMOTE_ADDR\'];
?>

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.