View Full Version : Ip ???
_PANKAJ_
11-28-2005, 07:29 PM
can any1 tell me how to get the IP adress of the person emailed to me... who filled my form ?:confused: ...
nkrgupta
11-29-2005, 05:09 AM
$ENV{REMOTE_ADD} is the variable which stores IP address of the client. Pass this variable while submitting the form and fetch it in your script.
Naveen
_PANKAJ_
11-29-2005, 05:45 AM
ok u mean print MAIL "$ENV{REMOTE_ADD}\n"; << this will do ... or i have to do something in my html form too ?
Email Address: <input type="text" name="email" size ="20"><br>
Subject: <input type="text" name="subject" size ="20"><br>
Message: <textarea name="message" cols="60" rows="6"></textarea><br>
<input type="submit" value="Submit">
Best Regards
Pankaj :thumbsup:
nkrgupta
11-29-2005, 06:15 AM
ok u mean print MAIL "$ENV{REMOTE_ADD}\n"; << this will do ... or i have to do something in my html form too ?
:
Absolutely... This will suffice.. In fact i mistakenly wrote earlier that you need to "pass" the variable while submitting the form. NO need to do anything in the html. And the variable is $ENV{REMOTE_ADDR} and not $ENV{REMOTE_ADD} as i earlier posted. Sorry for the goofup.
Naveen
_PANKAJ_
11-29-2005, 06:21 AM
thx Naveen ... I'll Check It .. n Let u KNow If Its Workin ... I cant Check It Now ... Cuz i m @ my college :p
Best Regards
Pankaj :thumbsup:
_PANKAJ_
11-29-2005, 10:02 AM
ok ... its not workin ... :rolleyes:
i just added ... this line into my script >>
print MAIL "$ENV{REMOTE_ADD}\n";
... everything else is workin properly...
but i cant get the IP addy
nkrgupta
11-29-2005, 10:10 AM
Hi Pankaj,
You probably didn't take note of my last post. The variable you need to print is $ENV{REMOTE_ADDR} and not $ENV{REMOTE_ADD}. I missed the 'R' in my first post.
Naveen
_PANKAJ_
11-29-2005, 12:09 PM
damn ! i didnt even noticed ... its workin fine now ....
thanku very much .... :thumbsup:
n 1 more thing more if u can help....
how to get ... the user PC info ....
print MAIL "$ENV{REMOTE_HOST}\n"; SHUD I USE THIS ?:confused:
bEST rEGARDS
Pankaj :thumbsup:
nkrgupta
11-29-2005, 01:47 PM
What do you exactly mean by "the user PC info"? For all the Environment variables containd in %ENV, you can have a look at them by running the following script -
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "<tt>\n";
foreach $key (sort keys(%ENV))
{
print "$key = $ENV{$key}<p>";
}
Samjhe guru :cool:
Naveen
_PANKAJ_
11-29-2005, 01:57 PM
thx naveen i got it :D
samaj gaya guruju :eek: :p
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.