Reputation: 5802
mysql_real_escape_string
is used for SQL statements. Is it enough for database security alone? For example with get_magic_quotes_gpc() we have use stripslashes. Is there any issue that we have to know about using other function with mysql_real_escape_string ?
Thanks in advance
Upvotes: 0
Views: 302
Reputation: 292
If you want to have a more secure database, simply escaping a string is not enough. This will definitely help in regards to SQL injection attacks, but there are a host of other methods to compromise a database.
Some pointers:
These are generally good practice and you should be aware of issues for databases outside the scope of just SQL injection attacks.
Upvotes: 3
Reputation: 1391
1)turn off magic_quotes_gpc
2)Is it enough with mysql_real_escape_string()
Upvotes: 0
Reputation: 158007
not really. SQL statements are different. for some of them it helps, for others - not.
I've answered that question recently: In PHP when submitting strings to the database should I take care of illegal characters using htmlspecialchars() or use a regular expression?
Hope it can give you the full picture, but you are welcome to ask if something is unclear.
Note that get_magic_quotes_gpc() and stripslashes are NOT database issue. It's just input data validation thing, and it has nothing to do with SQL
Upvotes: 2