PDA

View Full Version : Cgi - Ip



YUPAPA
July 12th, 2001, 12:30
Does anyone know how to log the IP?
Not $ENV{'REMOTE_ADDR'}

The IP in the run windows.
When you go to "Start" and go to "RUN" type in Winipcfg, and you will see your IP Address. Can the Perl Script get the IP (in the run windows) and display it on the page?

THANK YOU THANK YOU

puDDs
July 12th, 2001, 21:43
Not sure why you're saying "Not $ENV{'REMOTE_ADDR'}", cause when I run my ENV script, I'm seeing my IP with both:

$ENV{'REMOTE_HOST'}
and
$ENV{'REMOTE_ADDR'}

One of those should work for you...

YUPAPA
July 12th, 2001, 22:32
Can I see your script?

puDDs
July 13th, 2001, 00:10
Be my guest, its just a generic environment variable script...



#!/usr/bin/perl

print "Content-type: text/html\n\n";

foreach $key (sort keys %ENV) {
print $key, " = ", $ENV{$key}, "<br>\n";
}

exit (0);


I like to use it on free hosts that don't give you all the path info :)

YUPAPA
July 13th, 2001, 10:56
But the IP is not the same as this one.

Go here:
https://secure.instabill.com/payment/add.asp?merchantID=104069&ProductID=YupapaMegaUnixPackage

Then you see the IP address at the bottom of the page.
The last paragraph
the IP on the order page is different than '$ENV{'REMOTE_ADDR'}, why?

puDDs
July 13th, 2001, 19:41
Not exactly sure what you mean....that page shows my IP fine, same as REMOTE_ADDR....

YUPAPA
July 13th, 2001, 19:56
hmm.. mine is different

atlas
July 14th, 2001, 10:43
Do you have a 10.something or a 192.168.something address? Those are used on internal networks -- then you'll get your internet access through a gateway (which is the IP the outside world sees).

-mk
atlascgi.com

puDDs
July 14th, 2001, 11:50
That's true....for example, when I view env.pl on my server from this computer, REMOTE_ADDR shows up as 192.168.0.3, since I'm viewing env.pl from my internal network....when I check my IP on external sites it shows up as the server IP, since its the gateway I run thru....so that could possibly be his problem.