pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: scott.marlowe <scott.marlowe@ihs.com>
To: Tino Wildenhain <tino@wildenhain.de>
Cc: Nathaniel Price <nprice@tesseract.net>
Cc: pgsql-php@postgresql.org
Subject: Re: [GENERAL] Reordering results for a report
Date: Mon, 15 Dec 2003 09:25:41 -0700 (MST)
Message-ID: <Pine.LNX.4.33.0312150924290.2965-100000@css120.ihs.com> (raw)
In-Reply-To: <3FDD789A.7060201@wildenhain.de>

On Mon, 15 Dec 2003, Tino Wildenhain wrote:

> Hi Scott,
> 
> scott.marlowe schrieb:
> [...]
> > 
> > print "<url goes here...>?orderby=".$flds[$i]."moreurlstuffhere???";
> > 
> > Then, if the orderby is set when you build your query, just append it:
> > 
> > if (isset($orderby)){
> >   $query.= "order by ".$orderby"
> > }
> > 
> > Add some directional control:
> > 
> > if (isset($dir)){
> >   if ($dir=="down") $query.=" DESC";
> > }
> > 
> [...]
> 
> This leads to a nice SQL-injection posibility.
> At least it has to made sure that no illegal
> data can be transported via $orderby

Actually, the $flds[] array var is internally generated, and you'll 
notice that orderby is NOT a PHP var, but a field name.

Good point though, lots of folks "trust" user input without paying 
attention to injection issues, which is one reason I always setup servers 
with magic quotes on.  :-)




view thread (11+ messages)

Message-ID: <Pine.LNX.4.33.0312150924290.2965-100000@css120.ihs.com>
Permalink:  ../Pine.LNX.4.33.0312150924290.2965-100000@css120.ihs.com/
Also on:    postgresql.org/message-id/Pine.LNX.4.33.0312150924290.2965-100000@css120.ihs.com

 · 

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: scott.marlowe@ihs.com, tino@wildenhain.de, nprice@tesseract.net
  Subject: Re: [GENERAL] Reordering results for a report
  In-Reply-To: <Pine.LNX.4.33.0312150924290.2965-100000@css120.ihs.com>
  References: <3FDD789A.7060201@wildenhain.de> <Pine.LNX.4.33.0312150924290.2965-100000@css120.ihs.com>

* 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