Current location: Hot Scripts Forums » Other Discussions » Web Servers » How can we get the visitors ip address?


How can we get the visitors ip address?

Reply
  #1 (permalink)  
Old 10-21-09, 05:06 AM
nkamk nkamk is offline
New Member
 
Join Date: Oct 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
How can we get the visitors ip address?

I have attached my own ip address through http://www.ip-details.com/ . Like the same i want to know the visitors ip address. How can i chk that. Need some help?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 10-21-09, 08:02 AM
ruteckycs's Avatar
ruteckycs ruteckycs is offline
Coding Addict
 
Join Date: Jul 2009
Posts: 377
Thanks: 6
Thanked 10 Times in 10 Posts
Well in PHP you can do this:

PHP Code:

$Ip=$_SERVER['REMOTE_ADDR'];
echo 
"IP Address =".$Ip
__________________
This post was created with 100% recycled electrons.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 10-21-09, 08:41 AM
End User's Avatar
End User End User is offline
Level II Curmudgeon
 
Join Date: Dec 2004
Posts: 3,027
Thanks: 14
Thanked 35 Times in 33 Posts
This will attempt to give you the real IP address of a user:

// try and get the real IP address...
if (getenv('HTTP_CLIENT_IP')) {
$ip_address = getenv('HTTP_CLIENT_IP');
}elseif (getenv('HTTP_X_FORWARDED_FOR')) {
$ip_address = getenv('HTTP_X_FORWARDED_FOR');
}elseif (getenv('HTTP_X_FORWARDED')) {
$ip_address = getenv('HTTP_X_FORWARDED');
}elseif (getenv('HTTP_FORWARDED_FOR')) {
$ip_address = getenv('HTTP_FORWARDED_FOR');
}elseif (getenv('HTTP_FORWARDED')) {
$ip_address = getenv('HTTP_FORWARDED');
}else {
$ip_address = $_SERVER['REMOTE_ADDR'];
}
__________________
I don't live on the edge, but sometimes I go there to visit.
-------------------------------------------------------------------------
Sanitize Your Data | Oracle Date & Substring Functions | Code Snippet Library | [url=http://www.codmb.com/Call Of Duty[/url]
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 10-25-09, 10:03 PM
wendydyna wendydyna is offline
New Member
 
Join Date: Oct 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Why do you want other's ip?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 10-25-09, 10:38 PM
End User's Avatar
End User End User is offline
Level II Curmudgeon
 
Join Date: Dec 2004
Posts: 3,027
Thanks: 14
Thanked 35 Times in 33 Posts
Quote:
Originally Posted by wendydyna View Post
Why do you want other's ip?
It'll only return one IP, but the user may becoming through a proxy of some sort.
__________________
I don't live on the edge, but sometimes I go there to visit.
-------------------------------------------------------------------------
Sanitize Your Data | Oracle Date & Substring Functions | Code Snippet Library | [url=http://www.codmb.com/Call Of Duty[/url]
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #6 (permalink)  
Old 10-29-09, 07:38 PM
BurkeFour BurkeFour is offline
Newbie Coder
 
Join Date: Oct 2009
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by End User View Post
It'll only return one IP, but the user may becoming through a proxy of some sort.
The "HTTP_X_FORWARDED_FOR " header can provide information on a user behind a proxy server, if it is a "transparent" proxy. End-User's code above gives the full possibility of headers to check.

You can check an IP and proxy and pull up geo-location data on the IP addresses using My IP Address.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get the computer ip address through coding? nkamk Other Topics 6 04-12-11 01:29 AM
Freeze columns in a table Rita Negi Script Requests 1 09-01-09 09:23 AM
Ip Address Question? purpleman The Lounge 2 07-12-06 06:59 PM
Refresh IP Address thorchan Visual Basic 0 04-16-05 03:30 AM
Regular Expression IP Address Replacement CMIVXX PHP 3 11-20-04 08:27 AM


All times are GMT -5. The time now is 02:43 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.