ASP检测是否有不安全字符的Function
作者:小虫 日期:2009-06-26
不安全的字符其实很多的,很多人都会过滤掉,现在这写一个,只检测,不过滤的代码出来。。
希望能帮到有需要的朋友。
ASP/Visual Basic Code复制内容到剪贴板
- Function Check_Str(Input)
- Output = False
- If InStr(Input,Chr(32)) Then Output = True '空格
- If InStr(Input,Chr(33)) Then Output = True '!
- If InStr(Input,Chr(34)) Then Output = True '"
- If InStr(Input,Chr(35)) Then Output = True '#
- If InStr(Input,Chr(36)) Then Output = True '$
- If InStr(Input,Chr(37)) Then Output = True '%
- If InStr(Input,Chr(38)) Then Output = True '&
- If InStr(Input,Chr(39)) Then Output = True ''
- If InStr(Input,Chr(42)) Then Output = True '*
- If InStr(Input,Chr(43)) Then Output = True '+
- If InStr(Input,Chr(44)) Then Output = True ',
- If InStr(Input,Chr(46)) Then Output = True '.
- If InStr(Input,Chr(47)) Then Output = True '/
- If InStr(Input,Chr(58)) Then Output = True ':
- If InStr(Input,Chr(59)) Then Output = True ':
- If InStr(Input,Chr(60)) Then Output = True '<
- If InStr(Input,Chr(61)) Then Output = True '=
- If InStr(Input,Chr(62)) Then Output = True '>
- If InStr(Input,Chr(63)) Then Output = True '?
- If InStr(Input,Chr(64)) Then Output = True '@
- If InStr(Input,Chr(91)) Then Output = True '[
- If InStr(Input,Chr(92)) Then Output = True '\
- If InStr(Input,Chr(93)) Then Output = True ']
- If InStr(Input,Chr(94)) Then Output = True '^
- If InStr(Input,Chr(96)) Then Output = True '`
- If InStr(Input,Chr(123)) Then Output = True '{
- If InStr(Input,Chr(124)) Then Output = True '|
- If InStr(Input,Chr(125)) Then Output = True '}
- If InStr(Input,Chr(126)) Then Output = True '~
- Check_Str = Output
- End Function
使用方法:
用Check_Str(字符串变量)进行调用,包含不安全符号返回True,否则返回False
特别说明:
每条判断语句后面都有符号,想去掉某个符号检测,删除或注释掉相应的语句即可。
[上一页] 当前第1页,共1页:[1] [下一页]
评论: 0 条 | 查看: - 次
发表评论
上一篇
下一篇

文章来自:
Tags:
相关日志: