pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rod Taylor <rbt@rbt.ca>
To: Rod K <rod@23net.net>
Cc: Seader, Cameron <CSeader@idahopower.com>
Cc: pgsql-php@postgresql.org
Subject: Re: HTTP_AUTH and SQL WHERE Clause
Date: Sun, 28 Sep 2003 10:26:26 -0400
Message-ID: <1064759185.21931.32.camel@jester> (raw)
In-Reply-To: <KNEPILBLIADCDMMPIKIKCEEKCOAA.rod@23net.net>
References: <KNEPILBLIADCDMMPIKIKCEEKCOAA.rod@23net.net>

> The former:
> 
>  $sql= "SELECT * FROM tbl_authenticate WHERE username =
> '{$_SERVER['HTTP_AUTH_USER']}' AND password = '{$_SERVER['HTTP_AUTH_PW']}'";
> 
> and the later:
> 
>  $sql= "SELECT * FROM tbl_authenticate WHERE username =
> '".$_SERVER['HTTP_AUTH_USER']."' AND password =
> '".$_SERVER['HTTP_AUTH_PW']."'";
> 
> I prefer the later since it's a bit easier to read IMO.

Another alternative:

$sql = <<<END
SELECT * 
  FROM tbl_authenticate
 WHERE username = '%s'
   AND password = '%s';
END

$psql = sprintf($sql, pg_escape_string($_SERVER['HTTP_AUTH_USER']),
		pg_escape_string($_SERVER['HTTP_AUTH_PW']));

Attachments:

  signature.asc (application/pgp-signature, 186B) download

view thread (4+ messages)

Message-ID: <1064759185.21931.32.camel@jester>
Permalink:  ../1064759185.21931.32.camel@jester/
Also on:    postgresql.org/message-id/1064759185.21931.32.camel@jester

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-php@postgresql.org
  Cc: rbt@rbt.ca, rod@23net.net, CSeader@idahopower.com
  Subject: Re: HTTP_AUTH and SQL WHERE Clause
  In-Reply-To: <1064759185.21931.32.camel@jester>
  References: <KNEPILBLIADCDMMPIKIKCEEKCOAA.rod@23net.net> <1064759185.21931.32.camel@jester>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox