2010년 2월 12일 금요일

sql Injection 처리

특정 문자를 검색하여 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)통

댓글 없음:

댓글 쓰기