防止在Z-Blog上恶意广告评论的简单方法 用QQ邮箱阅读空间订阅我的博客。

十二月 28, 2005 | tags 程序  BLOG  修改   | views
Comments 6
  经常有无聊的人在留言里面发布广告,有一次我还无可奈何地说“spams的衣服真漂亮”,今天看到sipo那里发出了“防止在Z-Blog上恶意广告评论的简单方法”,转载存一下,有空来修改。这下就好了!
  修改方法:
  打开 c_system_event.asp
  在 Function PostComment() 下面,加上

Dim SRegExp,Matches,Matches2,Matches3,Matches4
  Set SRegExp=New RegExp
  SRegExp.IgnoreCase =True
  SRegExp.Global=True
  SRegExp.Pattern="http"
  Set Matches = SRegExp.Execute(Request.Form("inpArticle"))
  SRegExp.Pattern="www"
  Set Matches2 = SRegExp.Execute(Request.Form("inpArticle"))
    SRegExp.Pattern="URL"
  Set Matches3 = SRegExp.Execute(Request.Form("inpArticle"))
  SRegExp.Pattern="href"
  Set Matches4 = SRegExp.Execute(Request.Form("inpArticle"))
  If Matches.count>=2 or Matches2.count>=2 or Matches3.count>=4 or Matches4.count>=2 then    
  Set SRegExp=Nothing
  Response.Write "Sorry,you can only input one link"
    If isempty(Session("BanIP")) then
    Session("BanIP")=1
    Else
    Session("BanIP")=2
    End If
  Response.End
  End If
  Set SRegExp=Nothing
  If not isempty(Session("BanIP")) and Session("BanIP")=2 then
  Response.Write "Sorry,Your IP is Baned By Our Site."
  Response.End
  End IF

  如果有人在评论中发布了2个以上的链接,对http,www,URL,href都限制,则禁止发布评论,如果仍然发布,则简单Ban掉这个人。




发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。