Re: backslashes

From: Date: Sat, 28 Aug 2004 07:58:08 +0000
Subject: Re: backslashes
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-194989@lists.php.net to get a copy of this message
On Fri, 27 Aug 2004 18:29:50 -0400, Ryan Schefke <ryan@triomfgroup.com> wrote:
Thomas, I'm not sure what your point is. Please expand. Ryan
Do you really see nothing wrong with announcing to all users that they can run arbitrary SQL with your script?
well, the where clause in mysql is relativly safe, but suppose the user changes giftprint.php?passid=1&sort=WHERE thankyou='Not Sent' ORDER BY cash ASC to, say.. giftprint.php?passid=1&sort=OR 1, as the absolute most basic example. PHP no longer supports sending multiple queries with one mysql_query to make this not as bad, but if you put SQL in the url or in a form, you are just begging to have it changed. At the very least have sort=cash. Idealy the query should look something like: $sarr = array('name', 'event', 'description', 'cash', 'action', 'thankyou', ); $query = 'SELECT name, event, description, cash, action, thankyou FROM gifts WHERE customerID=' . intval($_GET['passid'] . ' ' . $sarr[intval($_GET['sort'])]; -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/

« previous php.general (#194989) next »