I need to prevent a user to create any input containing any quotes or brackets
if(strpos($str, '"') !== false ||
strpos($str, "'") !== false ||
strpos($str, "<") !== false ||
strpos($str, ">") !== false ||
strpos($str, "(") !== false ||
strpos($str, ")") !== false ||
strpos($str, "{") !== false ||
strpos($str, "}") !== false){
echo "input is not allowed";
}
1 - is there a shorter way to write this
2 - is this an enough safe way to sanitize inputs before place them inside a mysql database (using prepared statements)