Обсуждение: is there a function/variable with remote host addr?

Поиск
Список
Период
Сортировка

is there a function/variable with remote host addr?

От
David Ford
Дата:
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?

David



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

От
will trillich
Дата:
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!