I have an input field and I want to do a validation check that will prevent users from subitting SQL injection-like strings. How would this be done in JavaScript?
var userInput = '"SELECT * FROM Users WHERE UserId = " + txtUserId;'
var arrayCheck = [SELECT, FROM, WHERE];
So now I need to check userInput for the number of matches in the array arrayCheck.
If the number of matches is three or higher, return false, otherwise return true.
mysqli_real_escape_stringwill help! What if user want to input as"WHERE is the mall? I want to SELECT 10 shirts FROM there"