Received: from thor.tht.net ([209.47.145.4]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f0MDvS030600 for ; Mon, 22 Jan 2001 08:57:28 -0500 (EST) (envelope-from chris@greatbridge.com) Received: from j08.us.greatbridge.com (j08.us.greatbridge.com [216.54.52.148]) by thor.tht.net (8.9.3/8.9.3) with ESMTP id IAA06823 for ; Mon, 22 Jan 2001 08:54:55 -0500 (EST) (envelope-from chris@greatbridge.com) Received: from greatbridge.com (IDENT:ryan@localhost.localdomain [127.0.0.1]) by j08.us.greatbridge.com (8.9.3/8.9.3) with ESMTP id IAA09455; Mon, 22 Jan 2001 08:44:55 -0500 Message-ID: <3A6C3957.BE9D921E@greatbridge.com> Date: Mon, 22 Jan 2001 08:44:55 -0500 From: Chris Ryan Organization: GreatBridge LLC X-Mailer: Mozilla 4.72 [en] (X11; U; Linux 2.2.14-6.1.1smp i686) X-Accept-Language: en MIME-Version: 1.0 To: s CC: pgsql-php@postgresql.org Subject: Re: query checking References: <3A6B8264.5040902@bundabergcity.qld.gov.au> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200101/64 X-Sequence-Number: 129 Probably the most direct way to look for and catch such attempts would be to search for the semi-colon ';' and if it exists just give an error. Chris Ryan chris@greatbridge.com s wrote: > > I am writing a site that > does select/insert SQL commands with users input. > > There is a potential hazard if some one tries to execute there > own commands in an input box > eg. the user types into the input box on a form - [ "; delete * > from table; ] > > I'm after a regular expression (that'd be nice) or an algorithm to > tell that only one query is being passed to psql at a time. > > The query string will be processed if > Either - one SELECT command only > - one INSERT command only > - one UPDATE command only > ELSE - dont process query > > Any input would be much appreciated. > thanks, > stef