PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 9th, 2003, 06:32 AM
Pere Pere is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Location: Barcelona
Posts: 197 Pere User rank is Corporal (100 - 500 Reputation Level)Pere User rank is Corporal (100 - 500 Reputation Level)Pere User rank is Corporal (100 - 500 Reputation Level)Pere User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 2 Days 5 h 53 m 50 sec
Reputation Power: 7
Question How can I get the real IP ?

I use this...

Quote:
<head>
<? function get_ip() {
global $HTTP_X_FORWARDED_FOR, $REMOTE_ADDR;
if(empty($HTTP_X_FORWARDED_FOR)) {
$ip = $REMOTE_ADDR;
} else {
$ip = $HTTP_X_FORWARDED_FOR;
}
return $ip;
}
?>
<title>Untitled</title>
</head>
<body>
<? echo get_ip() ?>
</body>


.. but only get the ISP proxy IP number instead of viewer's one.

Any help?
Tks!

Note: the running script is in http://c2001.com/get_ip/
__________________
Pere
www.casti2001.com

Reply With Quote
  #2  
Old May 9th, 2003, 07:19 AM
jharnois's Avatar
jharnois jharnois is offline
mod_dev_shed
Dev Shed God 20th Plane (14500 - 14999 posts)
 
Join Date: Sep 2002
Location: Atlanta, GA
Posts: 14,569 jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 2 Days 22 h 42 m 51 sec
Reputation Power: 835
According to the user notes in the manual, there is also a $_SERVER['HTTP_CLIENT_IP'].

Complete discussion:
http://www.php.net/manual/en/langua....predefined.php

Reply With Quote
  #3  
Old May 9th, 2003, 07:51 AM
Pere Pere is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Location: Barcelona
Posts: 197 Pere User rank is Corporal (100 - 500 Reputation Level)Pere User rank is Corporal (100 - 500 Reputation Level)Pere User rank is Corporal (100 - 500 Reputation Level)Pere User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 2 Days 5 h 53 m 50 sec
Reputation Power: 7
Thank you.
I have just modified my script and now it looks...

Quote:
<head>
<?
function get_ip()
{
$ip = $_SERVER['HTTP_CLIENT_IP'];
return $ip;
}
?>
<title>Untitled</title>
</head>
<body>
<? echo get_ip() ?>
</body>


But still what I get is my ISP proxy IP. Not my server's one.

So what I need is a way to "by-pass" that proxy located between my computer and my server.

So any additional suggestion will be highly appreciated.

Reply With Quote
  #4  
Old May 9th, 2003, 09:11 AM
Pere Pere is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Location: Barcelona
Posts: 197 Pere User rank is Corporal (100 - 500 Reputation Level)Pere User rank is Corporal (100 - 500 Reputation Level)Pere User rank is Corporal (100 - 500 Reputation Level)Pere User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 2 Days 5 h 53 m 50 sec
Reputation Power: 7
Back to this matter, the problem of wrong IP is because of transparent anonymous proxy ISP Cache Servers.

Hope somebody knows the way to avoid receiving the proxy IP number instead of the server one.

Thanks !

Reply With Quote
  #5  
Old May 9th, 2003, 09:16 AM
cbailster cbailster is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Location: Birmingham, England
Posts: 115 cbailster User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
I don't think there's anything you can do then. The only way you can find out the IP address of the computer making the request to the proxy server is if the proxy sets the value of the X_FORWARDED_FOR variable when it makes the http request to your server. If this variable isn't set then you can't find out the client IP address. I.e. its acting in an anonymous fashion hence is end user is anonymous since you cant find out what their IP address is

Last edited by cbailster : May 9th, 2003 at 09:18 AM.

Reply With Quote
  #6  
Old May 9th, 2003, 09:37 AM
Pere Pere is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Location: Barcelona
Posts: 197 Pere User rank is Corporal (100 - 500 Reputation Level)Pere User rank is Corporal (100 - 500 Reputation Level)Pere User rank is Corporal (100 - 500 Reputation Level)Pere User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 2 Days 5 h 53 m 50 sec
Reputation Power: 7
Thank you Cbailster.

Then I am quite frustrated with my ISP. I am using our main ISP in Spain and they set up their proxy cache a couple of weeks ago having most of their clients totally upset.

Thanks again.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > How can I get the real IP ?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT