ASP过滤字符函数

ASP 1505 0 2013-02-16

ASP过滤字符函数

<%
str="lkdsoik" '这里为要过滤的字符
if ChkInvaildWord(str) then
response.write "你的输入含有非法字符"
else
response.write "你的输入的是合法字符"
end if
Function ChkInvaildWord(Words)
Const InvaildWords="select|update|delete|insert|@|--|http:|//|www|.com|.cn|.net" ''需要过滤得字符以“|”隔开,最后结束的字符必须是|

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指定字符截取字符串

下一篇:ASP判断只输出&quot;英文&quot;或&quot;汉字&quot;的两种方法

讨论数量:0

请先登录再发表讨论。 2024-05-01

天涯网魂
3 杠 5 星
TA 的文章
TA 的随言
TA 的资源链