asp中實(shí)現(xiàn)清除html的函數(shù)
這個(gè)函數(shù)是必需要的,很多黑客來(lái)?yè)v亂,黑掉數(shù)據(jù)庫(kù),會(huì)注入大量的病毒js,在存儲(chǔ)和展示文本數(shù)據(jù)的時(shí)候,使用此函數(shù)過濾一下,可避免不少麻煩
clearhtml代碼
'清除HTML代碼
function clearhtml(content)
content=replacehtml("&#[^>]*;","",content)
content=replacehtml("</?marquee[^>]*>","",content)
content=replacehtml("</?object[^>]*>","",content)
content=replacehtml("</?param[^>]*>","",content)
content=replacehtml("</?embed[^>]*>","",content)
content=replacehtml("</?table[^>]*>","",content)
content=replacehtml(" ","",content)
content=replacehtml("</?tr[^>]*>","",content)
content=replacehtml("</?th[^>]*>","",content)
content=replacehtml("</?p[^>]*>","",content)
content=replacehtml("</?a[^>]*>","",content)
content=replacehtml("</?img[^>]*>","",content)
content=replacehtml("</?tbody[^>]*>","",content)
content=replacehtml("</?li[^>]*>","",content)
content=replacehtml("</?span[^>]*>","",content)
content=replacehtml("</?div[^>]*>","",content)
content=replacehtml("</?th[^>]*>","",content)
content=replacehtml("</?td[^>]*>","",content)
content=replacehtml("</?script[^>]*>","",content)
content=replacehtml("(javascript|jscript|vbscript|vbs):","",content)
content=replacehtml("on(mouse|exit|error|click|key)","",content)
content=replacehtml("<\\?xml[^>]*>","",content)
content=replacehtml("<\/?[a-z]+:[^>]*>","",content)
content=replacehtml("</?font[^>]*>","",content)
content=replacehtml("</?h[^>]*>","",content)
content=replacehtml("</?u[^>]*>","",content)
content=replacehtml("</?i[^>]*>","",content)
content=replacehtml("</?center[^>]*>","",content)
content=replacehtml("</?center[^>]*>","",content)
content=replacehtml("</?nobr[^>]*>","",content)
content=replacehtml("</?clk[^>]*>","",content)
content=replacehtml("</?muti[^>]*>","",content)
content=replacehtml("</?/option[^>]*>","",content)
content=replacehtml("</?o[^>]*>","",content)
content=replacehtml("</?strong[^>]*>","",content)
clearhtml=content
end function
replacehtml代碼
function replacehtml(patrn,strng,content)
if isnull(content) then
content=""
end if
set regex=new regexp
regex.pattern=patrn
regex.ignorecase=true
regex.global=true
replacehtml=regex.replace(content,strng)
end function
使用方法:
<%=clearhtml("<div id="CodeTip"><h2>分享代碼提示(2)</h2><ul><li style="font-weight: bold; color: rgb(170, 0, 0);">添加完代碼必須點(diǎn)擊“完成并查看”生效</li><li>準(zhǔn)確的編程語(yǔ)言,可正確對(duì)代碼語(yǔ)法著色</li><li>輸入簡(jiǎn)單幾個(gè)字的代碼片段說明</li><li>上傳源碼文件時(shí)無(wú)需再輸入說明</li><li>非程序相關(guān)文件將直接刪除,嚴(yán)重封帳號(hào)</li><li>圖片僅用來(lái)上傳截圖之類的文件,勿作他途</li></ul></div>")%>
以上就是本文所述的全部?jī)?nèi)容了,希望大家能夠喜歡。
- ASP 時(shí)間函數(shù)及如何獲取服務(wù)器時(shí)間的寫法
- Asp Split函數(shù)之使用多個(gè)分割符的方法
- asp與js的類型轉(zhuǎn)換函數(shù)介紹
- asp中的Rnd 函數(shù)
- ASP轉(zhuǎn)換格林威治時(shí)間函數(shù)DateDiff()應(yīng)用
- ASP移動(dòng)文件函數(shù)movefile權(quán)限不足的替代方法
- ASP中實(shí)現(xiàn)的URLEncode、URLDecode自定義函數(shù)
- asp實(shí)現(xiàn)獲取MSSQL數(shù)據(jù)庫(kù)表指定條件行數(shù)的函數(shù)
- asp實(shí)現(xiàn)截取字符串函數(shù)
- ASP實(shí)現(xiàn)強(qiáng)制圖片下載函數(shù)
- ASP函數(shù)大全解析
相關(guān)文章
ASP上傳漏洞之利用CHR(0)繞過擴(kuò)展名檢測(cè)腳本
本文部分腳本具有攻擊性,僅供學(xué)習(xí)研究用,請(qǐng)用在合法合理范圍內(nèi),對(duì)造成的損失本人不承擔(dān)責(zé)任,本人也不提供黑客攻擊技術(shù)指導(dǎo)2012-01-01
asp 多關(guān)鍵詞搜索的簡(jiǎn)單實(shí)現(xiàn)方法
asp搜索兩個(gè)以上的詞的實(shí)現(xiàn)方法,簡(jiǎn)單的就是利用split,其它的可以參考本站之前更新的文章2008-11-11
實(shí)現(xiàn)純真IP txt轉(zhuǎn)mdb數(shù)據(jù)庫(kù)的方法
實(shí)現(xiàn)純真IP txt轉(zhuǎn)mdb數(shù)據(jù)庫(kù)的方法...2007-07-07
Active Server Pages 錯(cuò)誤 ''ASP 0201'' 修復(fù)方法
網(wǎng)上很多其他的解決方法, 但是我試了幾個(gè)小時(shí), 都沒有解決問題, 最后是通過這個(gè)方法解決的.2010-07-07
asp 根據(jù)IP地址自動(dòng)判斷轉(zhuǎn)向分站的代碼
根據(jù)IP地址自動(dòng)判斷轉(zhuǎn)向分站的代碼 這個(gè)是一個(gè)不錯(cuò)的解決之道,可以緩解服務(wù)器壓力過大等一些問題2008-11-11
asp之自動(dòng)閉合HTML/ubb標(biāo)簽函數(shù)附簡(jiǎn)單注釋
這樣的功能就是實(shí)現(xiàn)一般html,ubb標(biāo)簽的閉合,以前在pjblog中見過,一直沒用,這個(gè)函數(shù)不錯(cuò),建議可以參考下pjblog中的函數(shù)。2009-01-01

