欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

asp中實(shí)現(xiàn)清除html的函數(shù)

 更新時(shí)間:2015年03月17日 15:24:21   投稿:hebedich  
本文給大家分享的是在asp中實(shí)現(xiàn)清除HTML的函數(shù),非常的實(shí)用,有需要的小伙伴,參考下吧。

這個(gè)函數(shù)是必需要的,很多黑客來搗亂,黑掉數(shù)據(jù)庫,會(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("&nbsp;","",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

使用方法:

復(fù)制代碼 代碼如下:

<%=clearhtml("<div id="CodeTip"><h2>分享代碼提示(2)</h2><ul><li style="font-weight: bold; color: rgb(170, 0, 0);">添加完代碼必須點(diǎn)擊“完成并查看”生效</li><li>準(zhǔn)確的編程語言,可正確對(duì)代碼語法著色</li><li>輸入簡單幾個(gè)字的代碼片段說明</li><li>上傳源碼文件時(shí)無需再輸入說明</li><li>非程序相關(guān)文件將直接刪除,嚴(yán)重封帳號(hào)</li><li>圖片僅用來上傳截圖之類的文件,勿作他途</li></ul></div>")%>

以上就是本文所述的全部內(nèi)容了,希望大家能夠喜歡。

相關(guān)文章

最新評(píng)論