導航:首頁 > 凈水問答 > 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比較全的過濾相關的資料

熱點內容
聊城反滲透膜清洗 瀏覽:58
保山礦井污水處理設備多少錢 瀏覽:734
空氣過濾減壓閥怎樣 瀏覽:606
斗山回油濾芯上面裝的小碗是什麼 瀏覽:187
蒸餾裝置中的前餾分是什麼 瀏覽:275
污水用日語怎麼說 瀏覽:507
大眾2016polo換空氣濾芯怎麼換 瀏覽:697
water是什麼牌子的凈水器 瀏覽:560
雷沃鏟車液壓油箱怎麼換濾芯 瀏覽:897
蒸餾裝置中如何正確安裝溫度計 瀏覽:381
車用液壓機油濾芯怎麼清洗 瀏覽:437
納米水性環氧樹脂 瀏覽:296
凈化器定時h是什麼意思 瀏覽:313
一體式濾芯買什麼牌子的好 瀏覽:314
釀造酒與蒸餾酒成分比較 瀏覽:140
電熱水器排污水開關壞 瀏覽:177
污水廠排放量計算 瀏覽:325
飲水機冷膽漏水什麼原因 瀏覽:57
陶氏超濾膜2880過濾面積 瀏覽:823
沃康延齡泉飲水機怎麼樣 瀏覽:830