Skip site navigation (1) Skip section navigation (2)

Superuser log-in through a web interface?

From: Ken Tozier <kentozier(at)comcast(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Superuser log-in through a web interface?
Date: 2004-10-31 00:35:50
Message-ID: D05A2AF9-2AD4-11D9-B070-003065F300E2@comcast.net (view raw or flat)
Thread:
Lists: 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";
			}
		}
	}
?>


In response to

Responses

pgsql-general by date

Next:From: Oleg BartunovDate: 2004-10-31 04:29:21
Subject: Re: Question about ltree....
Previous:From: Tom LaneDate: 2004-10-30 23:12:21
Subject: Re: having clause question

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group