Gossamer Forum
Home : Products : Links 2.0 : Discussions :

$ENV('REMOTE_ADDR'} problem when modifying

Quote Reply
$ENV('REMOTE_ADDR'} problem when modifying
I add three fields in link.def called IP; Domain; Host, this field will be hiddenly added thru the add.html using
<%IP%> , <%Host%> & <%Domain%>, it works fine in add.html but if a user mofify their submission this information will not be overwrited with the new IP, Domain & Host, how to overwrite this info when a user modify a submission?

This is just for reference.

in site_html_template.pl I added the following:

# USED BY: gethostbyaddr
use Socket;

my $ipaddress = $ENV{'REMOTE_ADDR'};
my $hostname = scalar(gethostbyaddr(inet_aton($ipaddress), AF_INET));
my $hostdomain = $1 if $hostname =~ /.*\.([^.]*\.[^.]*)/;

print &load_template ('add.html', {
IP => $ipaddress,
Domain => $hostdomain,
Host => $hostname,

The information above is what I add, not the full add_form.


Thanks in advance,

Nuno Duque
--------------------
Macau Search Engine
searchmacau.com
Quote Reply
Re: $ENV('REMOTE_ADDR'} problem when modifying In reply to
Have you tested this by accessing the script from another ISP than your own? If you are testing it with your ISP connection, then guess what? Those fields will remain the same.

Wink

Regards,

Eliot Lee



Quote Reply
Re: $ENV('REMOTE_ADDR'} problem when modifying In reply to
Thanks for you answer but the problem isn't with the ISP.
I already solved the problem changing the tags in modify.html to <%MIP%>, <%MDomain%> & <%MHost%>, but using the same input names for sending the form like <input name="ip" value="<%MIP%>...> this will get new IP instead of the one in the database.
This is just for your reference.

in site_html_template.pl I changed the following:

# USED BY: gethostbyaddr
use Socket;

my $mipaddress = $ENV{'REMOTE_ADDR'};
my $mhostname = scalar(gethostbyaddr(inet_aton($mipaddress), AF_INET));
my $mhostdomain = $1 if $mhostname =~ /.*\.([^.]*\.[^.]*)/;

print &load_template ('add.html', {
MIP => $mipaddress,
MDomain => $mhostdomain,
MHost => $mhostname,


Thanks,

Nuno Duque
--------------------
Macau Search Engine
searchmacau.com