먹고 사는 일/Web

sql Injection 처리

니카루스 2010. 2. 12. 14:21

특정 문자를 검색하여 SQL에 치명적인 오류를 발생하는 문자일 경우

사용을 금지한다.

 

function checkSqlInjection(strData)

   dim CheckArray

   dim Checkdata

   CheckArray = Array("'or", "' or", "or'", "or '", "like'", "like '", "union ", " from ", "delete ", "insert ", "update ", "select ", "xp_cmdshell", "exec ", "master")

   checkSqlInjection="Y"

   for i=0 to ubound(CheckArray )

       Checkdata=0

       Checkdata=instr(strData, CheckArray(i))

       if CheckData>0 then

           checkSqlInjection = "N"

           exit function

       end if

   next

end function

출처 : Tong - 공원님의 ┣ ★ 먹고사는일(Web)통