Received: from bush.rutgersinsurance.com (rutgersinsurance.com [38.138.71.194]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f0OElbq14126 for ; Wed, 24 Jan 2001 09:47:37 -0500 (EST) (envelope-from aalang@rutgersinsurance.com) Received: from 6014cwpza006 ([10.10.10.51]) by bush.rutgersinsurance.com (8.9.3/8.9.3) with SMTP id JAA10498 for ; Wed, 24 Jan 2001 09:51:18 -0500 Message-ID: <006301c08614$e224bbe0$330a0a0a@6014cwpza006> From: "Adam Lang" To: References: <20010123203750.21463.qmail@web313.mail.yahoo.com> Subject: Re: Re: query checking Date: Wed, 24 Jan 2001 09:49:41 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 X-Archive-Number: 200101/72 X-Sequence-Number: 137 Even safer if yuo don't let users type in actual SQL at all. Have a set of check boxes so they can pick which type of query they want.(update, delete, select, etc.) Have them fill in fields and have them fill in tables. Then, in your php code, construct the sql code yourself, while checking the fields for ilelgal characters like ";" Adam Lang Systems Engineer Rutgers Casualty Insurance Company http://www.rutgersinsurance.com ----- Original Message ----- From: "Brent R. Matzelle" To: Sent: Tuesday, January 23, 2001 3:37 PM Subject: [PHP] Re: query checking > You might also try giving the client user different rights to > the database. Only allow select, insert, and update but > disallowing any deletes. That way you won't need to build it > into your PHP code. > > Brent > > --- 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 > > > > > ===== > "The instructions said install windows 98 or better, so I installed Linux" > > http://www.matzelle.net > > __________________________________________________ > Do You Yahoo!? > Yahoo! Auctions - Buy the things you want at great prices. > http://auctions.yahoo.com/