X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 27F62D1B526 for ; Sat, 27 Sep 2003 20:58:21 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 96556-08 for ; Sat, 27 Sep 2003 17:57:52 -0300 (ADT) Received: from Ariel2.idahopower.com (ariel2.idahopower.com [204.76.190.198]) by svr1.postgresql.org (Postfix) with SMTP id 8C75BD1B4F2 for ; Sat, 27 Sep 2003 17:57:49 -0300 (ADT) Received: from 204.76.195.33 by Ariel2.idahopower.com with ESMTP (IPCo Mail Relay at your service (MMS v4.7);); Sat, 27 Sep 2003 14:56:43 -0600 X-Server-Uuid: c4da1ae6-7048-11d2-bc8e-00a083360239 Received: from bedford.idacorp.local ([172.18.201.66]) by midway.idacorp.local with Microsoft SMTPSVC(5.0.2195.6713); Sat, 27 Sep 2003 14:57:27 -0600 X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 content-class: urn:content-classes:message MIME-Version: 1.0 Subject: HTTP_AUTH and SQL WHERE Clause Date: Sat, 27 Sep 2003 14:57:27 -0600 Message-ID: <71B8A8BEC516CF46835CA629156CF21163F5CE@bedford.idacorp.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: HTTP_AUTH and SQL WHERE Clause Thread-Index: AcOFOfVyeDcB+4kQQ+aGyYzdhYRHdQ== From: "Seader, Cameron" To: pgsql-php@postgresql.org X-OriginalArrivalTime: 27 Sep 2003 20:57:27.0446 (UTC) FILETIME=[F578A360:01C38539] X-WSS-ID: 136B2601155256-01-01 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/81 X-Sequence-Number: 2358 Hey Folks,=20 I am having trouble with some variables the $HTTP_AUTH_USER and $HTTP_AUTH_= PW - now im useing PHP 4.3.3 and so i know that you have to use $_SERVER['H= TTP_AUTH_USER'] and $_SERVER['HTTP_AUTH_PW'] instead of the old way now. We= ll i am having trouble with this script i have created to authenticate user= name and password and verify against a postgresql database below.=20 $auth =3D false; // Assume user is not authenticated=20 if (isset( $_SERVER['PHP_AUTH_USER'] ) && isset($_SERVER['PHP_AUTH_PW'])) {= =20 // Connect to MySQL=20 pg_pconnect("host=3D172.18.204.64 port=3D5432 dbname=3Dacquisuite_db user= =3Dpgadmin password=3Dpgadmin") or die ( 'Unable to connect to server.' );= =20 // Select database on MySQL server=20 // mysql_select_db( 'your_db' )=20 // or die ( 'Unable to select database.' );=20 // Formulate the query=20 $sql =3D ("SELECT * FROM tbl_authenticate WHERE username =3D '$PHP_AUTH_USE= R' AND password =3D '$PHP_AUTH_PW'");=20 // Execute the query and put results in $result=20 $result =3D pg_exec( $sql )=20 or die ( 'Unable to execute query.' );=20 // Get number of rows in $result.=20 $num =3D pg_num_rows( $result );=20 if ( $num !=3D 0 ) {=20 // A matching row was found - the user is authenticated.=20 $auth =3D true;=20 }=20 }=20 The Problem is on the $sql line when i put in the string to do the Query wi= th the WHERE clause having the $HTTP_AUTH_USER and $HTTP_AUTH_PW. When i ch= ange it to '$_SERVER['HTTP_AUTH_USER']' and '$_SERVER['HTTP_AUTH_PW']' it d= oes not work and i get a parse error.=20 How can i get around this?=20 does anyone have any ideas for me.=20 Thanks=20 Cameron Seader CSeader@Idahopower.com [INFO] -- Access Manager: This transmission may contain information that is privileged, confidential = and/or exempt from disclosure under applicable law. If you are not the int= ended recipient, you are hereby notified that any disclosure, copying, dist= ribution, or use of the information contained herein (including any relianc= e thereon) is STRICTLY PROHIBITED. If you received this transmission in err= or, please immediately contact the sender and destroy the material in its e= ntirety, whether in electronic or hard copy format. Thank you. A2