displays real ip address

By bangas on Oct 02, 2005

Displays the users real IP address, even if they are behind a web proxy.

<?php
$ip = isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'];
echo 'Your IP is: '.$ip; ?>

Comments

Sign in to comment.
Blitzjager   -  Oct 17, 2008

lol :P

 Respond  
Bullet_Dodger   -  Oct 17, 2008

Oh i didnt see that

 Respond  
guest598594   -  Oct 17, 2008

Where would i put this 'remotes' ?
Are you being serious? Cuz if so, look at the post above yours...

 Respond  
rhasttaff   -  Oct 17, 2008

haha yeas looooool :P ;H :P

 Respond  
Bullet_Dodger   -  Oct 17, 2008

Where would i put this 'remotes' ?

 Respond  
Sapphy   -  Sep 26, 2008

You would create a PHP file (.php) in your directory somewhere, then past his code in there, and save it. So, when you view your saved page, it will show your IP address. :P

 Respond  
Howie   -  Feb 02, 2008

Sorry if i sound really naive....but how do u use this?

 Respond  
Mystery   -  Feb 20, 2006

Actually, this won\'t grab the real ip (on all ocassions). Not all proxies store the real ip of the user in HTTP_X_FORWARDED_FOR. However, this is much better than going by just HTTP_REFERER. Not bad ;)

 Respond  
tye   -  Oct 04, 2005

Use this with caution since the X-Forwarded-For header can be sent by a client even if they\'re not being a proxy.

 Respond  
KuTsuM   -  Oct 03, 2005

Wow, nice job :)

 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.