As for how to prevent SQL injection attacks?
As long as in the use of the contents of the form input SQL command structure, before all the input filter is ok, filtering the input can be done by a variety of ways,
(1) for dynamic SQL query, use the following techniques:
First: to replace single quotes, namely all alone single quotation marks into two single quotes, prevent the attacker to modify the meaning of SQL commands,
The second: delete all the hyphen in user input,
Third: to used to execute the query database account, to limit its authority,
Use stored procedures to perform all of the query,
(3) limit the form or the length of the query string input,
(4) check the legitimacy of the user input and be sure to input the content contains only legitimate data,
5] the user login name and password stored encrypted data, such as
[6] check the number of records to extract data query returned,
CodePudding user response:
The practice of string concatenation is take temporary solution not effect a permanent cureCodePudding user response:
A parameterized query, preventing SQL injectionCodePudding user response:
Do not use the joining together of SQL, basically can hedge the SQL injection of 99%,