Web Page that displays IP?

Risc91

Junior Member
Mar 11, 2000
21
0
0
I would like to add a feature to my web page that displays the current viewers current IP address. How would I go about doing this??

(My reason for wanting to do this is: A friend of mine has a cable connection, but his IP is dynamic. Instead of having to remote login into his router he would like to be able to just put my page in his favorites and goto it to find out his IP info. )

Any info on this topic would be great. Thanks!!
 

joinT

Lifer
Jan 19, 2001
11,172
0
0
There's a very simple PHP script that should do it. I've used it before.

<?
$address = getenv("REMOTE_ADDR");
echo "Your IP address is $address.";
?>

you'd need to be running PHP on your computer.

even better, tell your friend to sign up for DynDNS.org & he can download a prog that will change whatever "Domain" he registered to his Dynamically changing IP address. So he can give out the "Domain", (say, risc91'sfriend.dyndns.org)
If he publishes a web-site, then www.risc91'sfriend.dyndns.org would take you to it. If he's running a Game server, then risc91'sfriend.dyndns.org would be the "Domain" for joining the game. It's very useful & FREE ~!~!

GL
 

Risc91

Junior Member
Mar 11, 2000
21
0
0
Hey, Thanks a lot for you help. Both suggestions are very helpfull. the DynDNS thing will be very usefull for me as well...don't need to keep repeating my IP for FTP access.
 

bot2600

Platinum Member
May 18, 2001
2,075
0
76
You can do that in plain HTML too, the REMOTE_ADDR is an enviroment variable in the connection, I can't remember the code for doing it in HTML, since I usually have done it in perl, but if you google ENV variables you should find a quick answer... I would do it real quick, but I am at school and I am not really supposed to be surfing...;) But, the class is pretty boring at the moment. I need to bring a keyboard with quieter keys, the teacher keeps looking at me funny.

Bot
 

Workin'

Diamond Member
Jan 10, 2000
5,309
0
0
Dynamic DNS services like dyndns make life really simple. I can't believe they do it for free, but they do! That's what I recommend for your friend.
 

joinT

Lifer
Jan 19, 2001
11,172
0
0
Doc, that's a nice site ;)

Damascus - that PHP page worked fine being served by IIS on my dev server.
 

Damascus

Golden Member
Jul 15, 2001
1,434
0
0


<< Damascus - that PHP page worked fine being served by IIS on my dev server. >>



Hmm okay. I thought REMOTE_ADDR was an Apache environment variable. Guess not.
 

bsobel

Moderator Emeritus<br>Elite Member
Dec 9, 2001
13,346
0
0
I threw a page up a long time ago for the some reason at here. Your welcome to use it if you like.
Bill