网络编程
位置:首页>> 网络编程>> Asp编程>> 防注入asp过滤sql特殊字符函数

防注入asp过滤sql特殊字符函数

  发布时间:2007-10-23 17:50:00 

标签:注入,过滤,sql


Function ChkInvaildWord(Words) 
Const InvaildWords="select|update|delete|insert|@|--|," 
''需要过滤得字符以“|”隔开,最后结束的字符必须是| 
ChkInvaildWord=True 
InvaildWord=Split(InvaildWords,"|") 
inWords=LCase(Trim(Words)) 
For i=LBound(InvaildWord) To UBound(InvaildWord) 
If Instr(inWords,InvaildWord(i))>0 Then 
ChkInvaildWord=True 
Exit Function 
End If 
Next 
ChkInvaildWord=False 
End Function 


防注入asp过滤sql特殊字符函数,使用方法比较简单,返回true则说明有特殊字符,给出拒绝提示即可,false则正常。


if ChkInvaildWord(Words)  = true then
response.write "请不要输入非法字符,谢谢合作!"
response.end
end if


0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com