Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 23994475D1C for ; Wed, 2 Oct 2002 14:39:04 -0400 (EDT) Received: from jive.SoftHome.net (jive.SoftHome.net [66.54.152.27]) by postgresql.org (Postfix) with SMTP id EA95A474E5C for ; Wed, 2 Oct 2002 14:39:02 -0400 (EDT) Received: (qmail 26899 invoked by uid 417); 2 Oct 2002 18:39:03 -0000 Received: from slide-.softhome.net (HELO softhome.net) (172.16.2.21) by shunt-smtp-out-0 with SMTP; 2 Oct 2002 18:39:03 -0000 Received: from localhost (localhost [127.0.0.1]) (uid 417) by softhome.net with local; Wed, 02 Oct 2002 12:39:02 -0600 From: adriantineo@softhome.net To: pgsql-php@postgresql.org Subject: Authenticating user Date: Wed, 02 Oct 2002 12:39:02 -0600 Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Sender: adriantineo@softhome.net X-Originating-IP: [217.216.221.78] Message-ID: X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/11 X-Sequence-Number: 1526 Hi all ! I am coding an application where I need to identify an user with username and password. His credentials are checked against the corresponding postgresql database user. I have been reading a good tutorial at devshed.com about how to do this but it is done in mysql in the example. The author claims that the best way to check if the user is valid is by sending this query: $query = "SELECT id from user WHERE username = '$user' AND password = PASSWORD('$pass')"; This way I could see if the user is valid by counting the results returned by the query without returning the credentials info. I kind of need a PASSWORD function for postgresql. Does it exist? I have been searching the docs but couldn't find it. I have tried: $query="SELECT usename from pg_user WHERE usename ='$user' AND password='$pass'; but it won't work. The only way it works is by doing this query: $query="SELECT usename from pg_shadow WHERE usename ='$user' AND password='$pass'; as the postgres user but I feel that I shouldn't be using the superuser or the security could be in risk. I would appreciate any comments, thank you. Adrian Tineo