Superuser log-in through a web interface? - Mailing list pgsql-general

From Ken Tozier
Subject Superuser log-in through a web interface?
Date
Msg-id D05A2AF9-2AD4-11D9-B070-003065F300E2@comcast.net
Whole thread Raw
In response to How to time several queries?  (nd02tsk@student.hig.se)
Responses Re: Superuser log-in through a web interface?  (Kevin Barnard <kevin.barnard@gmail.com>)
List pgsql-general
Hello all,

I'm trying to create a php form for logging in to postgress with
different level passwords and my first test with a superuser isn't
working unless I specify a database name. I would like to allow
superusers to log in without specifying a database so they can create
new users, databases etc from a web interface. Does anyone see what I'm
doing wrong in the following example?

Thanks for any help,

Ken

---------------------------------------------
I defined a super user like so

CREATE USER user_name CREATEUSER PASSWORD 'password'

Try to log in through a web form like so:

User: user_name
Password: password

but the connection always fails unless I specify a database.

Relevant PHP:

<?php

    function LogInUser()
    {
        if    (isset($_POST['user_name']) &&
            isset($_POST['password']))
        {
            $user         = $_POST['user_name'];
            $password    = $_POST['password'];

            $conn_string = "user=".$user." password=".$password." host=localhost
port=5432";
            $conn = pg_connect($conn_string);

            if ($conn)
            {
                echo "login succeeded";
            }
        }
    }
?>


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: having clause question
Next
From: Oleg Bartunov
Date:
Subject: Re: Question about ltree....