Z-BLOG屏蔽敏感關鍵字功能的代碼
下面是ZBLOG的屏蔽評論中敏感關鍵字的程序代碼,主要用于替換文章評論中的敏感或非法的關鍵字。
只需要修改一個文件c_system_event.asp,將其中的objComment.Content=Request.Form("inpArticle")修改為objComment.Content=WordFilter(Request.Form("inpArticle"))
然后在c_system_event.asp文件尾部加入代碼:
Function WordFilter(strInput) Dim i Dim strOutput Dim strFilter strFilter = Split("關鍵字1,關鍵字2,關鍵字3", ",") strOutput = strInput For i = 0 To UBound(strFilter) strOutput = Replace(strOutput, strFilter(i), String(Len(strFilter(i)), "×")) Next WordFilter = strOutput End Function
來源:月光博客