Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

How to get $ENV{'REMOTE_HOST'} through add.cgi

Quote Reply
How to get $ENV{'REMOTE_HOST'} through add.cgi
Hello!

I have tried to define the following in the add.cgi

sub process_form {
# --------------------------------------------------------
my ($in) = shift;
my ($found, $val, $key, $today, $rec, $id, $name, $category, $remotehost);


$in->param ( -name => 'remotehost' , -value => '$remotehost' );

in the add.html it has

<INPUT TYPE="hidden" NAME="remotehost" VALUE="">

It does not bring the $ENV{'REMOTE_HOST'} in the database field which is also correctly configured.
Quote Reply
Re: How to get $ENV{'REMOTE_HOST'} through add.cgi In reply to
Take a look at http://www.gossamer-threads.com/scripts/forum/resources/Forum9/HTML/000207.html
Maybe this will help you.

Chris
Quote Reply
Re: How to get $ENV{'REMOTE_HOST'} through add.cgi In reply to
If you dont need to display the Remote_Host to the surfer, then you dont need to put it in the form. Just grap the value of ENV{'REMOTE_HOST'} before inserting into the db.
i.e.

Just before $id = $val->add_record ( $rec );
Add $in->param ( -name => 'remotehost' , -value => $ENV{'REMOTE_HOST'} );
And it should work fine.

Chris
Quote Reply
Re: How to get $ENV{'REMOTE_HOST'} through add.cgi In reply to
Hello!

Thanks for your promt response.

Yes, I tried to grab before I put the message as it was pretty much simple to guess that.

No. Actually it does not add. I tried before already unsuccessfully and hence the message. May be there is something in def field thats should be there or not there? The last field is empty as I was forced to destroy the whole table configuration as it would not work with the imports. So I cannot have anything in there.


remotehost => ['27', 'CHAR', '15', '15', '0', '', ''],

I had add_record about add_date problems before that if the validatation(the last field) was not there or was empty, it did not add. May be thats the trick I should try. Not to leave it empty and see if thats the problem.

The change in the H_Template.pm you suggested is only for MSIE and not for ENV remote host. But its a way showing how to do it conceptually. I actually do not want to show it to the surfer but just to store it.

Add in the line $in before the cgi_to_hash or after also does not help, may be it does not make sense to do that! Wink

[This message has been edited by rajani (edited November 07, 1999).]
Quote Reply
Re: How to get $ENV{'REMOTE_HOST'} through add.cgi In reply to
Hello!

Even this does not work!

$in->param ( -name => 'remotehost' , -value => $ENV{'REMOTE_HOST'});

Now the last field has the normal input validation defaulted. So its not the defs! There is something I am missing?
Quote Reply
Re: How to get $ENV{'REMOTE_HOST'} through add.cgi In reply to
You have it declared in both the links.def and validate.def?
Do you have a field in your table?

I would do it like the example I showed with the MSIE stuff and pass it to the template. Just put it in the template as a hidden field and it should automatically be put into the db if your table and defs are correct.
Be sure to match char case in field names between the defs, table, and template vars.

Chris