這個(gè)函數(shù)是必需要的,很多黑客來(lái)?yè)v亂,黑掉數(shù)據(jù)庫(kù),會(huì)注入大量的病毒js,在存儲(chǔ)和展示文本數(shù)據(jù)的時(shí)候,使用此函數(shù)過(guò)濾一下,可避免不少麻煩
'清除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