Remote IP address

How do you get a visitors IP address without using ASP.

Is there an HTML solution?

What I want to do is get the remote IP, save it in a hidden field and have the existing form submit the data to an existing script for sstorage.

If there is no HTML solution I'll be happy with a freely available CGI script.
LVL 2
innovateAsked:
Who is Participating?
 
sybeCommented:
I don't think there is a HTML solution. As far as I know the only client-side solitions are java and ActiveX.

The easiest server-side solution is SSI (server side include) but it is not supported by alle servers.

<!--#echo var="REMOTE_ADDR"-->

So:

<input type="hidden" name="ip" value="<!--#echo var="REMOTE_ADDR"-->">

other server side solutions are CGI/ASP. They all will ask for "REMOTE_ADDR", how they do it depends a bit on the language.

==============
ASP:

<input type="hidden" name="ip" value="<%=Request.Servervariables("REMOTE_ADDR")%>">




0
 
innovateAuthor Commented:
Looks good,  I'll give it a test.  The server is IIS4 so it should work.  I'll reply in a short while with your points.
0
 
innovateAuthor Commented:
mmm? didn't work.  Tried it using a text field and it just showed

[<!--#echo var=       ]">

where the square brackets are the sides of the text box.  Client side Java would do if you have a snippet of code.

0
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

 
sybeCommented:
on IIS4 you'll have to rename the file from .htm to .shtm in order to enable SSI
0
 
sybeCommented:
And I am afraid the IIS4 does not know the SSI command "echo".

0
 
sybeCommented:
No, In tested it with ASP, that does NOT work, but in .stm, the echo stuff works !
0
 
sybeCommented:
So:

Rename the file from .htm(l) to .stm(l) and the SSI code will work fine.
0
 
innovateAuthor Commented:
Thanks sybe.

Worked fine on my NT4 machine but when I uploaded to the web (also an NT4 machine) it just returns an empty text box.  
I've awarded the points anyway because your answer is correct.
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.