| 关键词: filtrate Waiting filtration WaitingA lengtha ctraa keywords mid lengthb ctra |
<%'Cnxhacker.Net 全站系统文章和提交信息关键字过滤类源码'Cnxhacker.Net 奇奇编写'转贴请保留此信息,注释信息会被解释程序忽略,这不会对脚本的执行速度和程序整体性能造成任何影响,谢谢!'Add <!--#include file="filtration.asp"--> to the start of any page on which you want to call the function.'First, please specify some key words to filtrate and pass to Waiting, separate each with "|".'BE CAREFUL: No need to add another "|" at the end of the string.Waiting="Fa轮功|激情电影" 'If you want to give out a warning to cover it all when the above keywords are seen, specify the warning message here, one after another, separated by "|".WaitingtoCover="[提交的信息被过滤!!请勿在此提交广告或非法信息!!!]"'If you want the above keywords to filtrate to be taken place, specify the string with which you want to cover it.WaitingA="中国气功万岁!|动画片"'WARNING: The length of any of the specified keywords to filtrate CANNOT be zero or null.dim sa(),sb(),sc()dim ctra,ctrb,ctrc'OK. Everything is ready, Let's begin.lengtha=len(waiting)if mid(waiting,lengtha,1) ="|" thenwaiting=left(waiting,lengtha-1)lengtha=lengtha-1end iflengthb=len(waitinga)if mid(waitinga,lengthb,1) ="|" thenwaitinga=left(waiting,lengthb-1)lengthb=lengthb-1end iflengthc=len(waitingtocover)ctra=0:ctrb=0:ctrc=0for i=1 to lengthaif mid(waiting,i,1)="|" then ctra=ctra+1nextredim preserve sa(ctra+1)for i=1 to lengthbif mid(waitinga,i,1)="|" then ctrb=ctrb+1nextredim preserve sb(ctrb+1)ctraa=0for i=1 to lengthaif mid(waiting,i,1)<>"|" thentemps=temps+mid(waiting,i,1)else ctraa=ctraa+1sa(ctraa)=tempstemps=""if ctraa=ctra thenctraa=ctraa+1sa(ctraa)=right(waiting,lengtha-i)end ifend if nextctrbb=0temps=""for i=1 to lengthbif mid(waitinga,i,1)<>"|" thentemps=temps+mid(waitinga,i,1)else ctrbb=ctrbb+1sb(ctrbb)=tempstemps=""if ctrbb=ctrb thenctrbb=ctrbb+1sb(ctrbb)=right(waitinga,lengthb-i)end ifend if next'Call filtrate(filtration), "filtration" is the source string that you want to have which filtrate, to return a string after filtration.'You have two choices to filtrate a string:'1. To change the keywords you want to filtrate to others;'2. To cover all if any of the specified keywords exists.'Specify type of filtration, directly pass the value to "typetofil" when calling the function.'Space is processed as "".function filtrate(filtration,typetofil)dim ctrglobalfilt=filtrationselect case typetofilcase 1 for i=1 to ctra+1length=len(sa(i))for j=1 to len(filtration)if len(sa(i))>len(filtration) thenexit forend ifif len(mid(filtration,i))<len(sa(i)) then exit forend ifif mid(filtration,j,length)=sa(i) thentemp1=left(filtration,j-1)temp2=mid(filtration,j+length)filt=temp1+sb(i)+temp2end ifnextnextfiltrate=filtcase 2for m=1 to ctra+1if instr(1,filtration,sa(m))<>0 then filtrate=waitingtocoverexit functionend if nextfiltrate=filtrationcase elseend selectend function'Sample:'filtrate("激情电影免费看",1)="动画片免费看"'filtrate("我爱Fa轮功",2)="[提交的信息被过滤!!请勿在此提交广告或非法信息!!!]"'Programmed by Qiqi, Cnxhacker.NET%> |
|
声明:文章版权归原作者所有 部分文章转自互联网 如有侵权请联系
[邮箱地址] 删除
|