|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
How To Retrieve Client Ip Address
Hi,
Anyone know how to retrieve Client's IP Address, my php webserver was behind the proxy (firewall)? When i use --> $REMOTE_ADDR , show my proxy's IP address.. $HTTP_X_FORWARDED_FOR , show nothing Javascript below only works for Netscape, return nothing in IE, <script language="JavaScript"><!-- if (navigator.appName=='Netscape' && navigator.javaEnabled()) { hn = java.net.InetAddress.getLocalHost().getHostName(); ha = java.net.InetAddress.getLocalHost().getHostAddress(); document.write('HostName: '+ hn + '<br>' + 'HostAddress: '+ ha ); } //--></script> Thanks in Advance! PauL ![]() |
|
#2
|
||||
|
||||
|
You cannot depend upon any method to get the IP address. Some proxies just will not send it at all.
Shouldn't this be in the PHP or Javascript forum? What kind of solution (client or server side) do you want? ---John Holmes... |
|
#3
|
|||
|
|||
|
Sorry..Wrong forum!
![]() As stated above, i need to get client's ip address, any method...pls |
|
#4
|
|||
|
|||
|
Well there isn't a 100% reliable way to do it due to proxy servers, etc...
|
|
#5
|
||||
|
||||
|
Why do you think you need to get the IP address?
|
|
#6
|
|||
|
|||
|
Hi,
Usually proxies send the real client IP via a HTTP proxy header (usually HTTP_CLIENT_IP or HTTP_X_FORWARDED_FOR). So you should always attempt to extract the real client IP and use it instead of the proxy IP. Remember - sometimes it's impossible (anonymous proxies) - and no matter what you do - you'll always get the IP of the proxy. Try using this function to get the client IP, instead of REMOTE_ADDR or anything similar. PHP Code:
Aviv Shaham Think Offshore, Inc. http://www.think-offshore.com |
|
#7
|
|||
|
|||
|
try echo phpinfo(); see what u can get.
|
|
#8
|
|||
|
|||
|
it still showing the proxy ip address
|
|
#9
|
||||
|
||||
|
Listen to Sepo
Quote:
|
|
#10
|
||||
|
||||
|
Is there an echo in here?
![]() ![]() ![]() ---John Holmes... |
|
#11
|
|||
|
|||
|
Quote:
yup..it might not work at server site, that's y i'm looking for client site scripts like Javascript or VBScript, those script post the ip back as a parameter to my php..but no luck |
|
#12
|
||||
|
||||
|
|
|
#13
|
|||
|
|||
|
tried the script..not working..
|
| < |