| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 743 人关注过本帖
标题:屏蔽特殊字符出现的问题.
只看楼主 加入收藏
gaohanxiong
Rank: 1
等 级:新手上路
帖 子:67
专家分:0
注 册:2007-3-12
收藏
 问题点数:0 回复次数:3 
屏蔽特殊字符出现的问题.
<%
a="'|%|*|^|@|!"
b = split(a,"|")
function zuya(content)
aaa=content
for i=0 to ubound(b)
if instr(lcase(request.queryString("a")),b(i))<>0 then
'b(i)=""
aaa=replace(content,b(i),"")

end if

next
zuya=aaa
end function
%>
<%
content=request("a")
aa=zuya(content)
response.Write(aa)
%>
这个代码只能屏蔽只有一个特殊字符,,
两个以上就会显示了来了..
有高手可以帮帮我吗?

[此贴子已经被作者于2007-5-31 12:38:54编辑过]

搜索更多相关主题的帖子: 字符 content aaa zuya 
2007-05-31 12:27
gaohanxiong
Rank: 1
等 级:新手上路
帖 子:67
专家分:0
注 册:2007-3-12
收藏
得分:0 
2.asp?a=你好'
输出:
你好

2.asp?a=你好'*
输出:
你好'



2007-05-31 12:38
gaohanxiong
Rank: 1
等 级:新手上路
帖 子:67
专家分:0
注 册:2007-3-12
收藏
得分:0 
没人帮我嘛,,

2007-05-31 15:50
enlangs
Rank: 1
等 级:等待验证会员
威 望:2
帖 子:218
专家分:0
注 册:2007-5-28
收藏
得分:0 
<%
a="'|%|*|^|@|!"
b = split(a,"|")
function zuya(content)
aaa=content
for i=0 to ubound(b)
b=replace(content,b(i),"",1,-1,1)


next
zuya=b
end function
%>
<%
content=request("a")
aa=zuya(content)
response.Write(aa)
%>
给你一个ASP防注入函数
Function Checkstr(Str)
If Isnull(Str) Then
CheckStr = ""
Exit Function
End If
Str = Replace(Str,Chr(0),"", 1, -1, 1)
Str = Replace(Str, """", "&quot;", 1, -1, 1)
Str = Replace(Str,"<","&lt;", 1, -1, 1)
Str = Replace(Str,">","&gt;", 1, -1, 1)
Str = Replace(Str, "script", "&#115;cript", 1, -1, 0)
Str = Replace(Str, "SCRIPT", "&#083;CRIPT", 1, -1, 0)
Str = Replace(Str, "Script", "&#083;cript", 1, -1, 0)
Str = Replace(Str, "script", "&#083;cript", 1, -1, 1)
Str = Replace(Str, "object", "&#111;bject", 1, -1, 0)
Str = Replace(Str, "OBJECT", "&#079;BJECT", 1, -1, 0)
Str = Replace(Str, "Object", "&#079;bject", 1, -1, 0)
Str = Replace(Str, "object", "&#079;bject", 1, -1, 1)
Str = Replace(Str, "applet", "&#097;pplet", 1, -1, 0)
Str = Replace(Str, "APPLET", "&#065;PPLET", 1, -1, 0)
Str = Replace(Str, "Applet", "&#065;pplet", 1, -1, 0)
Str = Replace(Str, "applet", "&#065;pplet", 1, -1, 1)
Str = Replace(Str, "[", "&#091;")
Str = Replace(Str, "]", "&#093;")
Str = Replace(Str, """", "", 1, -1, 1)
Str = Replace(Str, "=", "&#061;", 1, -1, 1)
Str = Replace(Str, "’", "’’", 1, -1, 1)
Str = Replace(Str, "select", "sel&#101;ct", 1, -1, 1)
Str = Replace(Str, "execute", "&#101xecute", 1, -1, 1)
Str = Replace(Str, "exec", "&#101xec", 1, -1, 1)
Str = Replace(Str, "join", "jo&#105;n", 1, -1, 1)
Str = Replace(Str, "union", "un&#105;on", 1, -1, 1)
Str = Replace(Str, "where", "wh&#101;re", 1, -1, 1)
Str = Replace(Str, "insert", "ins&#101;rt", 1, -1, 1)
Str = Replace(Str, "delete", "del&#101;te", 1, -1, 1)
Str = Replace(Str, "update", "up&#100;ate", 1, -1, 1)
Str = Replace(Str, "like", "lik&#101;", 1, -1, 1)
Str = Replace(Str, "drop", "dro&#112;", 1, -1, 1)
Str = Replace(Str, "create", "cr&#101;ate", 1, -1, 1)
Str = Replace(Str, "rename", "ren&#097;me", 1, -1, 1)
Str = Replace(Str, "count", "co&#117;nt", 1, -1, 1)
Str = Replace(Str, "chr", "c&#104;r", 1, -1, 1)
Str = Replace(Str, "mid", "m&#105;d", 1, -1, 1)
Str = Replace(Str, "truncate", "trunc&#097;te", 1, -1, 1)
Str = Replace(Str, "nchar", "nch&#097;r", 1, -1, 1)
Str = Replace(Str, "char", "ch&#097;r", 1, -1, 1)
Str = Replace(Str, "alter", "alt&#101;r", 1, -1, 1)
Str = Replace(Str, "cast", "ca&#115;t", 1, -1, 1)
Str = Replace(Str, "exists", "e&#120;ists", 1, -1, 1)
Str = Replace(Str,Chr(13),"<br>", 1, -1, 1)
CheckStr = Replace(Str,"’","’’", 1, -1, 1)
End Function

[此贴子已经被作者于2007-5-31 16:57:55编辑过]

2007-05-31 16:56
快速回复:屏蔽特殊字符出现的问题.
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017283 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved