导航:首页 > 净水问答 > asp比较全的过滤

asp比较全的过滤

发布时间:2021-01-01 16:45:26

❶ asp 字符串过滤

我已写成一个函数,如下:
Function KeyWordAddLink(Byval strText,Byval strReplace)
Dim re,s,i,strKey,strSubKey
set re = New RegExp
re.IgnoreCase = True
re.Global = True
s = strText
strKey = Split(strReplace,"||")
For i = 0 To UBound(strKey)
If strKey(i) <> "" Then
strSubKey = Split(strKey(i),">>")
If strSubKey(0) <> "" Then
re.Pattern = "(^|[^\/\\\w\=])(" & strSubKey(0) & ")"
s=re.Replace(s, "$1<a target=""_blank"" href=""" & strSubKey(1) & """ class=""KeyLink""><font color=""red""><b>$2</b></font></a>")
End If
End If
Next
KeyWordAddLink=s
set re = nothing
End Function

参数strText :被替换的文本
参数strReplace :用来替换的文本
示例:
dim word,replaceStr
word="网络是搜索引擎"
replaceStr="网络>>http://www..com||搜索>>http://www.g.cn"
word = KeyWordAddLink(word,replaceStr)
Response.Write word

结果输出:
<a target="_blank" href="http://www..com" class="KeyLink"><font color="red"><b>网络</b></font></a>是一个<a target="_blank" href="http://www.g.cn" class="KeyLink"><font color="red"><b>搜索</b></font></a>引擎

❷ ASP过滤函数

正则可以帮你解决
给你一个过回滤HTML函数答

Function RemoveHTML(strHTML)
Dim objRegExp, Match, Matches
Set objRegExp = New Regexp
objRegExp.IgnoreCase = True
objRegExp.Global = True
objRegExp.Pattern = "<.+?>"
Set Matches = objRegExp.Execute(strHTML)
For Each Match in Matches
strHtml=Replace(strHTML,Match.Value,"")
Next
RemoveHTML=strHTML
Set objRegExp = Nothing
End Function

❸ ASP过滤脏字

Const yaoguolv="脏字1|脏字2" '需要过滤得字符以“|”隔开,最后结束的字符必须是|
yaoguolv1=Split(yaoguolv,"|")
word1=LCase(request.form("name"))
word2=LCase(request.form("lx"))
word3=LCase(request.form("title"))
For i=LBound(yaoguolv1) To UBound(yaoguolv1)
If Instr(word1,yaoguolv1(i))=0 Then
else
Response.Write "<script>alert('对不起,请不要输入脏字!');history.back();</script>"
response.end
End If
If Instr(word2,yaoguolv1(i))=0 Then
else
Response.Write "<script>alert('对不起,请不要输入脏字!');history.back();</script>"
response.end
End If
If Instr(word3,yaoguolv1(i))=0 Then
else
Response.Write "<script>alert('对不起,请不要输入脏字!');history.back();</script>"
response.end
End If
Next

❹ asp中如何过滤掉特殊字符

user=replace(trim(request.form("uName")),"'","''")
password=replace(trim(request.form("Password")),"'","''")
if instr(user,"%") or instr(user,"#") or instr(user,"?") or instr(user,"|") or instr(user,"'") then
response.write "<script language=javascript>alert('您的姓名含有非法字符!');this.location.href='login.asp';</script>"
response.end
end if

if instr(password,"%") or instr(password,"#") or instr(password,"?") or instr(password,"|") then
response.write "<script language=javascript>alert('您的密码含有非法字符!');this.location.href='login.asp';</script>"
response.end
end if 我自己做的,希望对你有帮助

❺ asp过滤所有的html代码函数

应该是可以过掉所有的标签的.大小写已经忽略,全局已经打开,多行也打开着,看了一下你的匹配专式也是正确的属啊.你过不掉的可能是因为中间有空间,而[^>]表示的是不包含>的所有字符.怎么会过滤不掉呢?

"<[\/]?\w+(\s+\w+\=[\"]?\w+[\"]?)*[\/]?>"
这样试试如何

❻ ASP脏话过滤

这写的很详细了

content=request("content")
content=replace(content,"脏话","**")
最好利用数据库,把要过滤的脏话都写入库
然后写个函专数,其中属用FOR循环上面的语句,“脏话”二字替换为从你数据库中读取的内容!!

❼ 求asp字符串过滤防止sql注入等安全选项的过滤代码

这个函数可以解决
Function SafeRequest(ParaName,ParaType)
'--- 传入参数 ---
'ParaName:参数名称-字符型
'ParaType:参数类型-数字型(1表示以上参数是数专字,0表示以上参数为属字符)
Dim ParaValue
ParaValue=Request(ParaName)
If ParaType=1 then
If not isNumeric(ParaValue) then
Response.write "参数" & ParaName & "必须为数字型!"
Response.end
End if
Else
ParaValue=replace(ParaValue,"'","''")
End if
SafeRequest=ParaValue
End function

❽ asp怎样过滤重复的词组

试试这个函数

<%
Dims
s="中国,美国,法国,意大利,美国,澳大利亚,中国,澳大利亚,泰国"
response.writedelR(s)

FunctiondelR(ByValstr)
Dimarr,b(),i,j,k,sf
arr=Split(str,",")
ReDimb(k):b(k)=arr(0)
Fori=1ToUBound(arr)
sf=False
Forj=0ToUBound(b)
Ifb(j)=arr(i)Then
sf=True
ExitFor
EndIf
Next
Ifsf=FalseThen
k=k+1
ReDimPreserveb(k)
b(k)=arr(i)
EndIf
Next
delR=Join(b,",")
EndFunction
%>

❾ ASP字符过滤。

username=trim(request.form("username"))
'定义一个数组
badCode="<,%,@,upload"
'分割数据
badCode=split(badCode,",")
'从第一个循环到最后一个
for i = 0 to ubound(badCode)
username=replace(username,badCode(i),"") '把这专些字符替换属为空
next

❿ ASP过滤掉之间的内容

REPLACE(
REPLACE("[img]UPic/20116/20116178203198148.gif[/img]","[img]",""),
"[/img]","")

阅读全文

与asp比较全的过滤相关的资料

热点内容
污水提升泵就看上海阳光泵业制造放心 浏览:642
qx56空调滤芯在什么位置 浏览:939
艾美森净水器废水怎么这么多 浏览:318
滤芯总净水量3m3表示什么 浏览:880
选矿废水与采矿废水各有什么特点 浏览:908
饮水机矮怎么办 浏览:594
除垢可以用草酸吗 浏览:835
去除水壶中水垢 浏览:611
什么自来水净化器好用 浏览:910
沼气废水怎么做 浏览:94
目前武汉市有哪些污水处理厂 浏览:247
反渗透去除什么离子 浏览:566
建筑业污水处理费怎么征收 浏览:666
轩逸经典的空调滤芯是什么样的 浏览:81
净水器上滤盒放在什么位置 浏览:719
净水器水满了怎么办 浏览:525
为什么纯净水是189升 浏览:176
樱慈净水器怎么更换滤芯 浏览:771
废水主要来源于 浏览:539
污水c0dm9l代表什么 浏览:893