中国有几大军区2017:asp发布文章时要怎么样过虑非安全字符

来源:百度文库 编辑:查人人中国名人网 时间:2024/04/29 15:44:55
最好以例子啊

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,每条判断语句后面都有符号,想去掉某个符号限制,删除或注释掉相应的语句即可。