屏蔽非法字符的代码
分类:电脑知识 发表于:2010-03-27 10:19:25 评论(0)
屏蔽非法字符的代码:
<%
Const BAN_LIST="测试,test"
Function BadWord(str, words)
Dim wordArr: wordArr = Split(words, ",")
For Each i In wordArr
If InStr(str, i) > 0 Then
BadWord = True
Exit Function
End If
Next
BadWord = False
End Function
If BadWord(name,BAN_LIST) Or BadWord(comment,BAN_LIST) Then
response.write "<script language=javascript>alert(´您用词不当´);location.href(´javascript:history.back();´);</script>"
Response.End
End If
%>