Page is a not externally linkable
- Code, Content, and Presentation
-- PHP Server Side Scripting
---- filtering mysql queries


jadebox - 9:43 pm on Nov 8, 2012 (gmt 0)


"Yes, I understand what a switch statement is, but is it necessary? Can't the actual value of the drop down list be that in the first place, rather than having to go through a switch statement?"

As the previous poster said, you'd have to verify that the values you receive are correct otherwise a hacker could use "SQL Injection" to cause some harm.

For example, if your web page returns something like "price < 10" as the value for one of the options, someone could call your script with the value set to something like "1=1; DROP TABLE users".

If your script just used the value without checking it, then it would execute a query like "SELECT * FROM products WHERE 1=1; DROP TABLE users" which could really mess up things on your site.


Thread source:: http://www.webmasterworld.com/php/4516699.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com