MySQL Forums
Forum List  »  General

Re: Unique Constraint Using My Own Definition of "Equals"
Posted by: Rick James
Date: March 07, 2009 11:55PM

Yep, mostly SOL.

The database can do some policing, but not all. While you are protecting your db from your users, ponder this "sql injection" nasty:

The user gets to input his name; let say you put it into $name. Then you execute this SELECT and return the results to him:
SELECT * FROM UserInfo WHERE name = '$name';
Now, let's suppose he fills in the form with
x' OR 'y' = 'y
Then you blissfully dump your entire table for him:
SELECT * FROM UserInfo WHERE name = 'x' OR 'y' = 'y';
Ok maybe that is not a good example, but do protect yourself by checking that numbers contain only digits and that strings are escaped (mysql_real_escape_string() or equivalent).

Options: ReplyQuote


Subject
Written By
Posted
Re: Unique Constraint Using My Own Definition of "Equals"
March 07, 2009 11:55PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.