This question is not about creating an actual alternative for the proven functions to prevent injections, but about how to argue with people that don't see the flaw in their homebrewed injection-prevention code!
I'm trying to make a point to a colleague but it seems his "solution" to SQL injection seems fairly safe to me.
He clears the query by doing
$query = $_POST['username'];
$look = array('&', '#', '<', '>', '"', '\'', '(', ')', '%');
$safe = array('&', '#', '<', '>', '"', ''', '(', ')', '%');
str_replace($look, $safe, $query);
And then proceeds with the login
"SELECT * FROM users WHERE username = '" . $query . "'
AND password = '" . md5($_POST['password']) . "'";
I am trying to get him to use PDO or equivalents, but how could you actually breach this protection? I don't have an answer and it's really bugging me because I can't explain him how this is unsafe and why it should not be done this way.