X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 89E96D1BAF7 for ; Wed, 7 Apr 2004 06:13:30 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 93358-07 for ; Wed, 7 Apr 2004 06:13:27 -0300 (ADT) Received: from mail1.dr.myx.net (mail1.dr.myx.net [217.10.193.161]) by svr1.postgresql.org (Postfix) with ESMTP id 4F061D1BABB for ; Wed, 7 Apr 2004 06:13:22 -0300 (ADT) Received: from appserver (unknown [82.137.2.202]) by mail1.dr.myx.net (mydomain.myx.net) with ESMTP id 2D0D6300B85; Wed, 7 Apr 2004 12:13:22 +0300 (EEST) Message-ID: <008c01c41c81$3e6609d0$6500a8c0@wylog.local> From: "Viorel Dragomir" To: "Yasmine Kedoo" , References: Subject: Re: PHP Username & Password Detection From PSQL Database Date: Wed, 7 Apr 2004 12:18:08 +0300 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0089_01C41C9A.632DBE20" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.3790.0 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200404/5 X-Sequence-Number: 2662 This is a multi-part message in MIME format. ------=_NextPart_000_0089_01C41C9A.632DBE20 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable :) For start you need ) here: if( trim($PHP_AUTH_USER) =3D=3D trim($username) && (trim($PHP_AUTH_PW)) ) ----- Original Message -----=20 From: Yasmine Kedoo=20 To: pgsql-php@postgresql.org=20 Sent: Wednesday, April 07, 2004 11:59 AM Subject: [PHP] PHP Username & Password Detection From PSQL Database Hi. I am just beginning to work with PHP & PSQL so forgive me if i make simpl= e=20 mistakes. :-) I created my PSQL database via telnet on my university's database server.= I=20 have no problems retrieving and displaying certain data using PHP, but i = am=20 unable to recognise a username and password entered via a predefined=20 authentication variable, $PHP_AUTH_USER. The script must recognise the username: 'yamkedoo', and password: 'yasmin= e'.=20 In the database, the username & password columns are spelt exactly as:=20 'username' & 'password'. The database name is 'yamkedoo', and the table n= ame=20 is 'PatPerInfo', as can be seen from the following code: if(!isset($PHP_AUTH_USER)) { Header("WWW-Authenticate: Basic realm=3D\"Authentication\""); Header( "HTTP/1.0 401 Unauthorized"); echo "No Login\n"; exit; } else { echo "User: $PHP_AUTH_USER
"; echo "Password: $PHP_AUTH_PW
"; } \n"; exit; } ?> After the username and password, i get the following error: Parse error:= =20 parse error in /home/webpages/yamkedoo/Tests/referrals2.php on line 44. Please view te following link:=20 http://www.cyber.brad.ac.uk/~yamkedoo/Tests/referrals2.php to see what is= =20 happening. Only once has the authentication window appeared, and has not done so sin= ce.=20 It only gives the error as seen at the link. Can anyone help? Thank You :-) _________________________________________________________________ It's fast, it's easy and it's free. Get MSN Messenger today!=20 http://www.msn.co.uk/messenger ---------------------------(end of broadcast)--------------------------- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match ------=_NextPart_000_0089_01C41C9A.632DBE20 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
:)
For start you need ) here:
if( trim($PHP_AUTH_USER) =3D=3D trim($username) && (trim($PHP_= AUTH_PW))=20 )
----- Original Message -----
Fro= m:=20 Yasm= ine=20 Kedoo
To: pgsql-php@postgresql.org
Sent: Wednesday, April 07, 2004 11= :59=20 AM
Subject: [PHP] PHP Username &= =20 Password Detection From PSQL Database

Hi.

I am just beginning to work with PHP & PSQL= so=20 forgive me if i make simple
mistakes. :-)

I created my PSQL=20 database via telnet on my university's database server. I
have no pro= blems=20 retrieving and displaying certain data using PHP, but i am
unable to= =20 recognise a username and password entered via a predefined
authentica= tion=20 variable, $PHP_AUTH_USER.

The script must recognise the username:= =20 'yamkedoo', and password: 'yasmine'.
In the database, the username &a= mp;=20 password columns are spelt exactly as:
'username' & 'password'. T= he=20 database name is 'yamkedoo', and the table name
is 'PatPerInfo', as c= an be=20 seen from the following=20 code:

if(!isset($PHP_AUTH_USER))
{
Header("WWW-Authenticate:= =20 Basic realm=3D\"Authentication\"");
Header( "HTTP/1.0 401=20 Unauthorized");

echo "No Login\n";
exit;
}
else
{
e= cho=20 "User: $PHP_AUTH_USER<BR>";
echo "Password:=20 $PHP_AUTH_PW<BR>";
}
<?PHP
$database =3D=20 pg_connect("host=3Dpgdbs.inf.brad.ac.uk dbname=3Dyamkedoo
user=3Dyamk= edoo=20 password=3Dyamkedoo");

if(!$database)
    = =20 {
        print "Connection to data= base=20 failed.";
    =20 }

else
       =20             &= nbsp; =20 {
       =20             &= nbsp; =20 $selectquery =3D "SELECT * FROM=20 PatPerInfo";
         =20             &= nbsp; =20 $result =3D pg_exec($database, $selectquery);

$maxrows =3D=20 pg_numrows($result);
        &= nbsp; =20 $maxfields =3D=20 pg_numfields($result);

       &= nbsp; =20 for ($rw =3D 0; $rw < $maxrows; $rw++)
     =20 {
   $username =3D pg_Result($result,$rw,0);
$password = =3D=20 pg_Result($result,$rw,1);

if( trim($PHP_AUTH_USER) =3D=3D trim($us= ername)=20 && (trim($PHP_AUTH_PW))
{
  $auth =3D=20 1;
}
          = =20             &= nbsp;   =20 }

     echo=20 $auth;
}

     =20 if($auth=3D=3D0)
     {
    = ; print=20 "Access Denied<BR>\n";
    =20 exit;
     }


?>

After the use= rname=20 and password, i get the following error: Parse error:
parse error in= =20 /home/webpages/yamkedoo/Tests/referrals2.php on line 44.

Please vi= ew te=20 following link:
http:= //www.cyber.brad.ac.uk/~yamkedoo/Tests/referrals2.php=20 to see what is
happening.
Only once has the authentication window= =20 appeared, and has not done so since.
It only gives the error as seen = at=20 the link.

Can anyone help?

Thank You=20 :-)

______________________________________________________________= ___
It's=20 fast, it's easy and it's free. Get MSN Messenger today!
http://www.msn.co.uk/messenger


---------------------------(end=20 of broadcast)---------------------------
TIP 9: the planner will ignor= e=20 your desire to choose an index scan if your
    &n= bsp;=20 joining column's datatypes do not match ------=_NextPart_000_0089_01C41C9A.632DBE20--