Re: is there a function/variable with remote host addr?

From: will trillich <will(at)serensoft(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: is there a function/variable with remote host addr?
Date: 2001-09-05 02:43:00
Message-ID: 20010904214300.D8460@serensoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Sep 04, 2001 at 01:41:52AM -0400, David Ford wrote:
> As the subject says, is there a function or variable in pg I can use as
> a default insert/update value on a column that represents the IP or
> hostname of the current session's remote client?

presuming you're using apache/mod_perl, you can get it from
$r->connection->remote_ip

and then slip it into your sql however you like. i use

$sth = $dbh->prepare("insert into hits (client_ip) values ( ? )");
$sth->execute( $r->connection->remote_ip );

--
Hey, let's change the whole justice system. Everybody gets to
kill one person -- if you do two, you go to jail. That should
cut down on the abrasive personalities, don't you think?

will(at)serensoft(dot)com
http://sourceforge.net/projects/newbiedoc -- we need your brain!
http://www.dontUthink.com/ -- your brain needs us!

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2001-09-05 03:59:48 Re: [GENERAL] DBD::Pg errstr method doesn't return full error messages
Previous Message will trillich 2001-09-05 02:26:56 Re: !! Newbie question!!!! connecting to multiple databases