Re: is there a function/variable with remote host addr? - Mailing list pgsql-general

From will trillich
Subject Re: is there a function/variable with remote host addr?
Date
Msg-id 20010904214300.D8460@serensoft.com
Whole thread Raw
In response to is there a function/variable with remote host addr?  (David Ford <david@blue-labs.org>)
List 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@serensoft.com
http://sourceforge.net/projects/newbiedoc -- we need your brain!
http://www.dontUthink.com/ -- your brain needs us!

pgsql-general by date:

Previous
From: will trillich
Date:
Subject: Re: !! Newbie question!!!! connecting to multiple databases
Next
From: "Taher H. Haveliwala"
Date:
Subject: storing large graphs in postgres