From time to time I come across scary statements like this :
I did use concatenation fefore but now I do like this:
Anyway, I'm sure that there are plenty of wrong things that I do and I want to find out about it.
So, in order to avoid sql injections and other security/structural problems, what are the dos and don'ts, what are the best practices?
Depending on the amount of information gathered, this thread could be turned into a FAQ in the future.
Thanks !
2) Your code is using string concatenation to build the SQL used to access the database. You're vulnerable to a SQL Injection attack, and people are taking advantage of the hole in your code (extremely bad). To fix it: change your code to use best-practices database access for your language.
I did use concatenation fefore but now I do like this:
Code:
$sql_query[1] = "
SELECT
*
FROM
my_table
WHERE
blahblah
AND
blahblah
";
$sql_result[1] = mysql_query($sql_query[1], $GLOBALS["_db_connect"]);
$sql_num[1] = mysql_num_rows($sql_result[1]);
Anyway, I'm sure that there are plenty of wrong things that I do and I want to find out about it.
So, in order to avoid sql injections and other security/structural problems, what are the dos and don'ts, what are the best practices?
Depending on the amount of information gathered, this thread could be turned into a FAQ in the future.
Thanks !