
31/07/2008, 12:10
|
| | Fecha de Ingreso: diciembre-2002
Mensajes: 473
Antigüedad: 22 años, 4 meses Puntos: 0 | |
sql inyection Hola gente,estoy usando este codigo para contrarestar SQL inyection y me gustaria me dieran vuestra opinion, o bien si tienen algun otro codigo mas optimo. Este lo use con exito en varias webs pero en una entraron aunque verifique faltaba ponerlo en dos paginas y estimo sera por eso.
en cada pagina: Cita: If IllegalChars(elid)=True Then
Response.redirect("index.asp")
End If la funcion: Cita: 'Function IllegalChars to guard against SQL injection
Function IllegalChars(sInput)
'Declare variables
Dim sBadChars, iCounter
'Set IllegalChars to False
IllegalChars=False
'Create an array of illegal characters and words
sBadChars=array("select","update", "drop", ";", "--", "insert", "delete", "xp_", _
"#", "%", "&", "'", "(", ")", "/", "\", ":", ";", "<", ">", "=", "[", "]", "?", "`", "|")
'Loop through array sBadChars using our counter & UBound function
For iCounter = 0 to uBound(sBadChars)
'Use Function Instr to check presence of illegal character in our variable
If Instr(sInput,sBadChars(iCounter))>0 Then
IllegalChars=True
End If
Next
End function
Gracias por cualquier idea desde ya! |