當前位置:首頁 » 凈水方式 » asp過濾

asp過濾

發布時間: 2020-12-17 17:47:18

⑴ 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過濾()中間的內容 包括()符號

<%
dim x,x1,x2
x="asp過濾(123456999999999999999999)中間的內內容容"
x1=split(x,"(")
for i=0 to ubound(x1)
Next
x2=split(x1(1),")")
for j=0 to ubound(x2)
Next
response.write x1(0)&x2(1)
%>

⑶ ASP字元過濾。

username=trim(request.form("username"))
'定義一個數組
badCode="<,%,@,upload"
'分割數據
badCode=split(badCode,",")
'從第一個循環到最後一回個
for i = 0 to ubound(badCode)
username=replace(username,badCode(i),"") '把這些字元替換為答空
next

⑷ asp過濾函數的用法問題

你直接在ASP里調用就行了

比如你現在有一個名為「w」的變數
w的值是被過濾的語句,內你想過濾掉w里的「'」、「容<」、「javascript」……(也就是上面那個函數的內容)

那麼直接用:
df=checkStr(w)
就行了,這就是調用了這個函數
註:df也是一個變數,他的值就是把w的值去掉上面函數中所過濾的那些字元後 的值了。

比如w的值是「javascript000document」(也就是:w="javascript000document")

用:df=checkStr(w)
後,df的值就是「/javascript000/document」了。

⑸ 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過濾字元

不知道你的具體需求是什麼,下面給你4個函數,都是很不錯的,你自己看著用吧:

Function HtmlFormat(ByVal str)
If Not IsN(str) Then
Dim m : Set m = RegMatch(str, "<([^>]+)>")
For Each Match In m
str = Replace(str, Match.SubMatches(0), regReplace(Match.SubMatches(0), "\s+", Chr(0)))
Next
Set m = Nothing
str = Replace(str, Chr(32), " ")
str = Replace(str, Chr(9), " ")
str = Replace(str, Chr(0), " ")
str = regReplace(str, "(<[^>]+>)\s+", "$1")
str = Replace(str, vbCrLf, "<br />")
End If
HtmlFormat = str
End Function
Function HtmlEncode(ByVal str)
If Not IsN(str) Then
str = Replace(str, Chr(38), "&")
str = Replace(str, "<", "<")
str = Replace(str, ">", ">")
str = Replace(str, Chr(39), "'")
str = Replace(str, Chr(32), " ")
str = Replace(str, Chr(34), """)
str = Replace(str, Chr(9), " ")
str = Replace(str, vbCrLf, "<br />")
End If
HtmlEncode = str
End Function
Function HtmlDecode(ByVal str)
If Not IsN(str) Then
str = regReplace(str, "<br\s*/?\s*>", vbCrLf)
str = Replace(str, " ", Chr(9))
str = Replace(str, """, Chr(34))
str = Replace(str, " ", Chr(32))
str = Replace(str, "'", Chr(39))
str = Replace(str, "'", Chr(39))
str = Replace(str, ">", ">")
str = Replace(str, "<", "<")
str = Replace(str, "&", Chr(38))
str = Replace(str, "&", Chr(38))
HtmlDecode = str
End If
End Function
Function HtmlFilter(ByVal str)
str = regReplace(str,"<[^>]+>","")
str = Replace(str, ">", ">")
str = Replace(str, "<", "<")
HtmlFilter = str
End Function
Function GetScriptTime(StartTimer)
GetScriptTime = FormatNumber((Timer()-StartTimer)*1000, 2, -1)
End Function

⑺ asp如何過濾傳遞的數據

Function rp(c)
c=Replace(c,"""","")
c=Replace(c,"'","")
c=Replace(c," ","")
c=Replace(c,"%","")
c=Replace(c,"#","")
c=Replace(c,"&","")
c=Replace(c,"*","")
c=Replace(c,"(","")
c=Replace(c,")","")
c=Replace(c,"@","")
c=Replace(c,"`","")
c=Replace(c,"/","")
c=Replace(c,"\","")
c=Replace(c,",","")
c=Replace(c,".","")
c=Replace(c,"=","")
c=Replace(c,"<","")
c=Replace(c,">","")
rp=c
End function

⑻ asp過濾 怎麼寫

<%
Dim str_arr,str_word,noid,badwords
str_arr="<!來-$arr->"

str_word = "賭博源"&st_arr&"黃賭"&st_arr&"海洛因"
str_word_no="**"

content_word="這里是你的文章內容"

badwords=split(str_word,str_arr)

For noid=0 to ubound(badwords)
re_word=badwords(noid)
content_word=content_word&replace(content_word,re_word,str_word_no)

Next
%>

⑼ 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過濾字元串

這兩個函數一個去掉標記和一個不去掉標記:
Function outHTML(str)
Dim sTemp
sTemp = str
outHTML = ""
If IsNull(sTemp) = True Then
Exit Function
End If
sTemp = Replace(sTemp, "&", "&")
sTemp = Replace(sTemp, "<", "<")
sTemp = Replace(sTemp, ">", ">")
sTemp = Replace(sTemp, Chr(34), """)
sTemp = Replace(sTemp, Chr(10), "<br>")
outHTML = sTemp
End Function

Function inHTML(str)
Dim sTemp
sTemp = str
inHTML = ""
If IsNull(sTemp) = True Then
Exit Function
End If
sTemp = Replace(sTemp, "&", "&")
sTemp = Replace(sTemp, "<", "<")
sTemp = Replace(sTemp, ">", ">")
sTemp = Replace(sTemp, Chr(34), """)
inHTML = sTemp
End Function

熱點內容
丁度巴拉斯情人電影推薦 發布:2024-08-19 09:13:07 瀏覽:886
類似深水的露點電影 發布:2024-08-19 09:10:12 瀏覽:80
《消失的眼角膜》2電影 發布:2024-08-19 08:34:43 瀏覽:878
私人影院什麼電影好看 發布:2024-08-19 08:33:32 瀏覽:593
干 B 發布:2024-08-19 08:30:21 瀏覽:910
夜晚看片網站 發布:2024-08-19 08:20:59 瀏覽:440
台灣男同電影《越界》 發布:2024-08-19 08:04:35 瀏覽:290
看電影選座位追女孩 發布:2024-08-19 07:54:42 瀏覽:975
日本a級愛情 發布:2024-08-19 07:30:38 瀏覽:832
生活中的瑪麗類似電影 發布:2024-08-19 07:26:46 瀏覽:239