- Feb 13, 2001
- 83,769
- 19
- 81
I need to prevent some SQL injection on existing forms. Is there a method that I can do, say like:
Thanks
Å
Code:
Function SQLFix(myVariable)
' single quote ok
myVariable = Replace(myVariable, "'", "''" )
' no double quotes
myVariable = Replace(myVariable, """", "" )
' no parenthesis
myVariable = Replace(myVariable, ")", "" )
myVariable = Replace(myVariable, "(", "" )
' no semi-colon
myVariable = Replace(myVariable, ";", "" )
' no dash
myVariable = Replace(myVariable, "-", "" )
' no pipe
myVariable = Replace(myVariable, "|", "" )
SQLFix = myVariable
end Function
for x = 1 to Request.Form.count()
Request.Form.item(x) = SQLFix(Request.Form.item(x))
next
Thanks
Å