让广告成为历史

现在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    
%>
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值