Get Client's IP Address.

Hi,
Is there a script that can get me the client's IP address.
And if that client is behind a proxy or firewall can I get both the client's internal IP address as well as his proxy's Ip address?
soso071898Asked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
kollegovConnect With a Mentor Commented:
Quite strange that it didn't work for you. Do you mean that when you accessed
my page at
http://www.geocities.com/virtual_max/vmaxipcatcher.html
you didn't got your IP address?
May be you wasn't patient enough? Sometimes geocities is too slow, and applet loading can be a bit slow..

Can you tell details of browser you use?

Actually, doesn't matter that you are behind proxy, it must work.

As for license terms :)...
Any of my applets are absolutely free with KEY  "Free Version", but free versions expose link back to my site. In addition this applet with "free version" do not perform javascript callback.

I can build version of VMaxIPcatcher which wouldn't have the last limitation.  You can e-mail me virtual_max@geocities.com and I'll e-mail you package.
0
 
kollegovCommented:
You can't detect user IP with Javascript when MIE used as browser.  
MIE always return 127.0.0.1
(:Bill's understanding of security :)
Meanwhile it possible to do with my VMaxIPCatcher Java Applet. It have JavaScript callback of setIP(ip) javascript function, so you can define this function and it will be called and IP will be passed into this function.. You would find applet at my site
http://come.to/vmax 
follow links in menu..                 ->applets->misc->VMaxIpCatcher

This applet work for NN3+, MIE4+
and return client IP even if client is behind firewall..Sorry, I don't know the way to get clien't firewall/proxy IP address...

Virtual_Max
0
 
lambdaCommented:

Using CGI you can get the client (proxy) IP from environment variable:

$ENV{'REMOTE_ADDR'};
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
soso071898Author Commented:
Thanks Kollegov but I need to use GetIpAddress function on the clients side (not in CGI) in my application which I am developing for a client. I need a way to make this by myself or use a free non-licensed code. Is your class free for commercial use? Also The code posted at your page is not working on my PC which is behind a proxy. I expected to get at least the local IP address.
0
 
GlobalVillageCommented:
I'm entering into this kind of late, but will this do?

<SCRIPT LANGUAGE="JavaScript">
<!-- Begin

if ((navigator.appVersion.indexOf("4.") != -1) && (navigator.appName.indexOf("Netscape") != -1)){
ip = "" + java.net.InetAddress.getLocalHost().getHostAddress();
document.write("Your IP address is " + ip);
}
else {
document.write("IP Address only shown in Netscape with Java enabled!");
}
//  End -->
</script>
0
 
GlobalVillageCommented:
But where are my manners.  You'll need IE code as well.

Try this one:

<SCRIPT LANGUAGE="JavaScript">
<!-- Begin

if ((navigator.appVersion.indexOf("4.") != -1) && (navigator.appName.indexOf("Netscape") != -1)){
ip = "" + java.net.InetAddress.getLocalHost().getHostAddress();
alert("Your IP address is " + ip);
}
else {
if(navigator.javaEnabled() && (navigator.appName != "Microsoft Internet Explorer")) {
vartool=java.awt.Toolkit.getDefaultToolkit();
addr=java.net.InetAddress.getLocalHost();
host=addr.getHostName();
ip=addr.getHostAddress();
alert("Your host name is '" + host + "'\nYour IP address is " + ip);
   }
}
 
//  End -->
</script>



0
 
kollegovCommented:
Global Village, before posting code
it's a good manner to test it yourself...

1. MIE do not allow to call classes from java packages directly..
2. Among 2  branches of your code
one for Navigator
and other NOT for explorer :-)

Where is explorer branch????

Soso, you need to run applet via http:// protocol to get IP. It wouldn't detect IP in case it was started from local file

0
 
soso071898Author Commented:
Comment accepted as answer
0
 
soso071898Author Commented:
Thanks for all of you.
Kollegov's applet is working fine
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.