1樓:網友
把遮蔽字串放在乙個陣列中,dim a : a = array("販毒","遮蔽字元2","遮蔽字元3")
然後。for each str in a
content = replace(a,str,"*next
asp中怎麼樣轉換、過濾、遮蔽提交內容裡面的非法字元或html**
2樓:網友
用repalce 函式替換就可以了,比如我要把變數x中的所有《去掉那麼就是x=replace(x,"<","")如果我要把它裡面的所有《換成a,那麼就這樣寫:
x=replace(x,"<","a")
請教asp中如何過濾禁止註冊的字元?
3樓:網友
假定資料庫為 資料表為table 遮蔽欄位名為notallowed使用者註冊名錶單為registername
則**如下:
dim conn,rs,forbiden,s,errtipset conn="")
set rs="")
select notallowed from [table]",conn,1,1
if not( or then
forbiden=rs(0)
end if
set rs=nothing
set conn=nothing
s=split(forbiden,"|") '分割|取得禁用詞。
for i=0 to ubound(s)
if instr("registername"),s(i))>0 then
errtip="註冊名中不允許存在「"&s(i)&"」等詞語"
end if
errtip
asp遮蔽多個惡意字元!asp 網頁
4樓:網友
一樓正解。用instr(str,badword(i)) 0 和replace(str,badword(i),"***")就可以做到了。
怎樣實現asp程式禁止非法字元的釋出或提交?
5樓:
dim conn,rs,forbiden,s,errtipset conn="")
資料表")set rs="")
select 表名 from [儲存非旅備改法字的欄位名]",conn,1,1
if not( or then
forbiden=rs(0)
end if
set rs=nothing
set conn=nothing
s=split(forbiden,"|分割|取得禁用詞for i=0 to ubound(s)
if instr("提交的內容"),s(i))>0 thenerrtip="釋出資訊中不允許包含「"&s(i)&"滾舉等詞語拆判"
end if
next errtip
寫asp時提交資料中要怎樣遮蔽字元?
6樓:網友
使用server物件,urlencode方法。
注:根據url規則對字串進行編碼。當字串資料以url格式傳遞到伺服器時,串中間不能有空格,不能有特殊字元,這時,你就必須用url編碼。
例:<%"<")%>
7樓:
1、一般要遮蔽的字元有:html標記,特殊字元(單、雙引號)
2、可以使用replace()函式遮蔽。
8樓:網友
要遮蔽的字元有以下這些:
%_",這是在寫入資料庫時容易出問題。
>&空格回車",這個在html顯示時需要處理"select,insert,等",sql常用命令,需要處理,防止注入。
9樓:
一般都是用replace()去替換from提交過來的引數!
你可以寫乙個類,去替換!以後就不每個頁面都去寫一邊了!
例如replace("asdklj'asdlkj'asdlkfj'","'","『")
replace("asdk select * from asldkjflj'asdlkj'asdlkfj'","select","select")
就可以了!直接替換成全形的!
這樣,你即使不替換回去,也知道是什麼!
asp禁止字元的問題,**等謝謝
10樓:網友
你想說明什麼問題啊。
11樓:
s=split(forbiden,"|") '分割|取得禁用詞for i=0 to ubound(s)
if instr("registername"),s(i))>0 then
errtip="註冊名中不允許存在「"&s(i)&"」等詞語"
end if
next
答辯問到用asp如何遮蔽字元怎麼回答
12樓:網友
用replace()函式,把要過濾的字元替換成空字元。也可用於檢測是否有非法字元,就是在替換之前用len函式測得字串長度,替換後再測一次,如果後者小於前者說明有非法字元。
13樓:網友
把要提交的字元用替換函式把特定字元更換成空格或者直接 ""就可以了。
asp中for迴圈,ASP中如何實現for迴圈?
初始化時,a的值為空串 因為對於第一次迴圈時候,a有個初值為 他被輸出而注意看到a a 而不是 a 因此每次迴圈時字串a後會被新增乙個 那第二次就變成 第三次當然就是 這樣就可以實現這樣的輸出效果。關鍵在於這句 a a 在迴圈第一次時,a的值為空,那麼a a 就是 a 空,再連線了乙個 那麼a其實就...
asp轉義字元,asp net轉義字元「 」的用法
response.write 這樣是抄乙個雙引 response.write 這樣是輸出2個雙引 當然你還可以這麼寫 response.write chr 34 文字 效果出來是 文字 希望能對你有幫助 轉義字元 串 escape sequence 也稱字元實體 character entity a...
求ASP中的替換函式,asp批量替換函式
老刀正能量 dim str str replace string,chr 34 quot str replace str,chr 38 amp str replace str,chr 39 39 str replace str,str replace str,gt str replace str,c...