Re: UPDATE and redirect

From: Date: Wed, 11 Apr 2007 21:04:27 +0000
Subject: Re: UPDATE and redirect
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-252633@lists.php.net to get a copy of this message
Marcelo Wolfgang wrote:
and what if $_GET['id'] is something like "1; DROP TABLE tb_emails;" ?? SQL injection just waits to happen
Something I just thought, he could do a drop table inside an update statement ? because the query is : UPDATE tb_emails SET bol_active = $action WHERE auto_id = $id so if he changed the $action or the $id, it will be inside the UPDATE, doesn't changing any of the variables to a DROP TABLE just give an error ? TIA Marcelo No. That's why he put the semi-colon after the 1.
It becomes update tb_emails set bol_active = $action where auto_id = 1; drop table tb_emails; That's two separate statements that will be happily executed if you're not careful. Try it (on a scratch table). Lori

« previous php.general (#252633) next »