ASP: Eliminare Sql

Molto spesso capita che utenti molto furbi tentino di violare le interrogazioni ai dB, inserendo all’interno del sito del codice Sql. Per evitare questo tipo di attacco, filtrate le informazioni inserite in questo modo:

%
Function CleanStr(sTesto)
'Se non e' una stringa vuota ...
If Len(sTesto)0 Then
sTesto = Replace(sTesto,"'","''")
stesto = replace(sTesto, "*", "[*]")
stesto = replace(sTesto, "%", "[%]")
End If
CleanStr=sTesto
End Function
%

Infine, filtrati i campi form cosi:

xxx = CleanStr(Request.Form(“yyy”))%

Articoli simili

Lascia un commento

Your email is never published nor shared. Required fields are marked *

*
*

This is a captcha-picture. It is used to prevent mass-access by robots. (see: www.captcha.net)

You must read and type the 5 chars within 0..9 and A..F, and submit the form.

  

Oh no, I cannot read this. Please, generate a