Is it enough to replace all single quotes in a T-SQL statement with double quotes to prevent injections?
I have this PHP function to escape user input which is then executed directly.
<?php
function clean($input) {
return str_replace('\'', '\'\'', $input);
}
echo 'INSERT INTO Temp ([test]) VALUES (\'' .clean($_GET['test']). '\')';
Example: $_GET['test']
is 'test
, it would be escaped to '''test'
.
I know, I should use prepared statements, but I want to know if this is vulnerable.