让广告成为历史

来源:互联网 发布:mac tar.gz 解压命令 编辑:程序博客网 时间:2024/04/28 09:22
现在BLOG越来越流行了,但那些烦人的广告依旧层出不穷。今天闲来无事,写了一小段屏蔽广告的函数(当然只能用于有源代码的BLOG),和大家一起分享。如果那位有更好,也别忘了给介绍介绍。
代码如下:
                                                                                                                  


<%
'/////////////////////////////////////////////////////////
'函数名:ADShield
'函数作用:广告屏蔽
'参数:strcontent
'参数含义:待处理的文本
'////////////////////////////////////////////////////////
function ADShield(strcontent)
    dim strtext
    dim mystring
    dim i,j,n
    j=1
    ADShield=true
    strtext=lcase(strcontent)
    mystring=split(strtext,"url","-1","1")
    n=UBound(MyString)
    '评论中的超级连接超过3个句开始判断
    if n<=6 then
       ADShield=true
       exit function
    else
       strtext=replace(replace(replace(strtext,"[url=http://","/"),"[/url]",""),"]","/")
       mystring=split(strtext,"/","-1","1")
       for i=lbound(mystring) to ubound(mystring)
                if i+2<=ubound(mystring) then
                    if trim(mystring(i))=trim(mystring(i+2)) then
                       j=j+1
                    end if
                end if             
       next
       '连接域名和连接文字重复出现5次以上就不能发表评论
       if j>=5 then 
          ADShield=false
          exit function
       end if      
       ADShield=true
       exit function
    end if   
end function    
%>
 
原创粉丝点击