Pg_connect in PHP

Started by Henk van Lingenover 25 years ago7 messagesgeneral
Jump to latest
#1Henk van Lingen
henkvl@cs.uu.nl

Anyone using PHP and WWW-authenticate ??

I do:

$database = pg_Connect ("host=db.example.com port=5432
user=$PHP_AUTH_USER password=$PHP_AUTH_PW dbname=base");

That works, except when PHP_AUTH_PW contains a space. Is there a way
to use passwords containing spaces?

Regards,
-- 
+-----------------------------------------------------------------------+
| Henk van Lingen, Systems Administrator,             <henkvl@cs.uu.nl> |
| Dept. of Computer Science, Utrecht University.  phone: +31-30-2535278 |
+----------------- http://www.cs.uu.nl/people/henkvl/ ------------------+
#2Vince Vielhaber
vev@michvhf.com
In reply to: Henk van Lingen (#1)
Re: Pg_connect in PHP

On Thu, 13 Jul 2000, Henk van Lingen wrote:

Anyone using PHP and WWW-authenticate ??

I do:

$database = pg_Connect ("host=db.example.com port=5432
user=$PHP_AUTH_USER password=$PHP_AUTH_PW dbname=base");

That works, except when PHP_AUTH_PW contains a space. Is there a way
to use passwords containing spaces?

Regards,

How about:

$database = pg_Connect ("host=db.example.com port=5432
user=$PHP_AUTH_USER password=\"$PHP_AUTH_PW\" dbname=base");

Vince.
--
==========================================================================
Vince Vielhaber -- KA8CSH email: vev@michvhf.com http://www.pop4.net
128K ISDN from $22.00/mo - 56K Dialup from $16.00/mo at Pop4 Networking
Online Campground Directory http://www.camping-usa.com
Online Giftshop Superstore http://www.cloudninegifts.com
==========================================================================

#3Henk van Lingen
henkvl@cs.uu.nl
In reply to: Vince Vielhaber (#2)
Re: Pg_connect in PHP

On Thu, 13 Jul 2000, Vince Vielhaber wrote:

That works, except when PHP_AUTH_PW contains a space. Is there a way
to use passwords containing spaces?

How about:

$database = pg_Connect ("host=db.example.com port=5432
user=$PHP_AUTH_USER password=\"$PHP_AUTH_PW\" dbname=base");

It seems, that doesn't work. Database complaining about authentication
failure (it things the quote is part of the password, I think?).

Regards,                   
-- 
+-----------------------------------------------------------------------+
| Henk van Lingen, Systems Administrator,             <henkvl@cs.uu.nl> |
| Dept. of Computer Science, Utrecht University.  phone: +31-30-2535278 |
+----------------- http://www.cs.uu.nl/people/henkvl/ ------------------+
#4Vince Vielhaber
vev@michvhf.com
In reply to: Henk van Lingen (#3)
Re: Pg_connect in PHP

On Thu, 13 Jul 2000, Henk van Lingen wrote:

On Thu, 13 Jul 2000, Vince Vielhaber wrote:

That works, except when PHP_AUTH_PW contains a space. Is there a way
to use passwords containing spaces?

How about:

$database = pg_Connect ("host=db.example.com port=5432
user=$PHP_AUTH_USER password=\"$PHP_AUTH_PW\" dbname=base");

It seems, that doesn't work. Database complaining about authentication
failure (it things the quote is part of the password, I think?).

Try single quotes: password='$PHP_AUTH_PW'

Vince.
--
==========================================================================
Vince Vielhaber -- KA8CSH email: vev@michvhf.com http://www.pop4.net
128K ISDN from $22.00/mo - 56K Dialup from $16.00/mo at Pop4 Networking
Online Campground Directory http://www.camping-usa.com
Online Giftshop Superstore http://www.cloudninegifts.com
==========================================================================

#5Henk van Lingen
henkvl@cs.uu.nl
In reply to: Vince Vielhaber (#4)
Re: Pg_connect in PHP

On Thu, 13 Jul 2000, Vince Vielhaber wrote:

How about:

$database = pg_Connect ("host=db.example.com port=5432
user=$PHP_AUTH_USER password=\"$PHP_AUTH_PW\" dbname=base");

It seems, that doesn't work. Database complaining about authentication
failure (it things the quote is part of the password, I think?).

Try single quotes: password='$PHP_AUTH_PW'

That works!

I thought that wouldn't work because PHP doesn't substitute variables
between single quotes :-(

Thanx,
-- 
+-----------------------------------------------------------------------+
| Henk van Lingen, Systems Administrator,             <henkvl@cs.uu.nl> |
| Dept. of Computer Science, Utrecht University.  phone: +31-30-2535278 |
+----------------- http://www.cs.uu.nl/people/henkvl/ ------------------+
#6Sergio A. Kessler
sak@tribctas.gba.gov.ar
In reply to: Henk van Lingen (#3)
Re: Pg_connect in PHP

Henk van Lingen <henkvl@cs.uu.nl> el d�a Thu, 13 Jul 2000 16:25:40 +0200
(CEST), escribi�:

How about:

$database = pg_Connect ("host=db.example.com port=5432
user=$PHP_AUTH_USER password=\"$PHP_AUTH_PW\"

dbname=base");

It seems, that doesn't work. Database complaining about authentication
failure (it things the quote is part of the password, I think?).

yup, postgres uses ' instead of ", try with ' (single quote)

$database = pg_Connect ("host=db.example.com port=5432
user=$PHP_AUTH_USER password='$PHP_AUTH_PW' dbname=base");

sergio

#7Jesus Aneiros
aneiros@jagua.cfg.sld.cu
In reply to: Henk van Lingen (#1)
Re: Pg_connect in PHP

Use the other form of Pg_Connect. The one that uses , delimiters.

On Thu, 13 Jul 2000, Henk van Lingen wrote:

Show quoted text

Anyone using PHP and WWW-authenticate ??

I do:

$database = pg_Connect ("host=db.example.com port=5432
user=$PHP_AUTH_USER password=$PHP_AUTH_PW dbname=base");

That works, except when PHP_AUTH_PW contains a space. Is there a way
to use passwords containing spaces?

Regards,
-- 
+-----------------------------------------------------------------------+
| Henk van Lingen, Systems Administrator,             <henkvl@cs.uu.nl> |
| Dept. of Computer Science, Utrecht University.  phone: +31-30-2535278 |
+----------------- http://www.cs.uu.nl/people/henkvl/ ------------------+