拳皇有多少个版本:asp过滤问题,高手来!

来源:百度文库 编辑:高考问答 时间:2024/04/29 17:40:34
<p>[upload=gif]UploadFile/2006-7/2006731817283367.gif[/upload]<br/></p><p></p><p></p><p>234324324234234234234234</p><p>234</p><p>32</p><p>423</p><p>4</p><p>234</p><p>234</p>

我想把里面的图片地址过滤出来,还有这个
]<br/></p><p></p><p></p><p>234324324234234234234234</p><p>234</p><p>32</p><p>423</p><p>4</p><p>234</p><p>234</p><img src="http://localhost/dvbbs/dv_plus/tools/magicface/gif/1.gif" border="0" alt=""/>]<br/></p><p></p><p></p><p>234324324234234234234234</p><p>234</p><p>32</p><p>423</p><p>4</p><p>234</p><p>234</p>

<%
'如何过滤图片的函数 function find_img(strtemp)
'版权没有,任意抄写,注意完整,有问题+QQ:105187501
'测试环境 WIN2K3 IIS6.0+ASP BY [GRKZ]sean
'测试时间 2006-7-7 下午(没有风扇的情况下-_-!!通过测试)
strtemp="ssss<img alt=""sss"" src=""http://www.test.com/test.jpg"" /><img alt=""sss"" src=""http://www.test.com/test.png"" /><img alt=""sss"" src=""http://www.test.com/test.bmp"" /><img alt=""sss"" src=""http://www.test.com/test.gif"" />ddddddddddssss<img src=""http://www.test.com/test2.gif"" alt=""sss"" />dddddddddd"
find_img(strtemp)
function find_img(strtemp)
dim arrtemp
dim i,url_gif,num_gif,url_jpg,num_jpg,url_png,num_png,url_other,num_other
arrtemp=split(strtemp,"<img")
if Ubound(arrtemp)<=0 then response.Write "没有检测到图片标识" : exit function
response.Write "一共检测到图片标识数量:"&Ubound(arrtemp)&"<br>"
for i=1 to Ubound(arrtemp)
temp=cutstr(cutstr(cutstr(arrtemp(i),"right"," />"),"left","src="""),"right","""")
ext=Ucase(right(temp,4))
select case ext
case ".GIF"
url_gif = url_gif&"|"&temp
num_gif = num_gif + 1
case ".JPG"
url_jpg = url_jpg&"|"&temp
num_jpg = num_jpg + 1
case ".PNG"
url_png = url_png&"|"&temp
num_png = num_png + 1
case else
url_other = url_other&"|"&temp
num_other = num_other + 1
end select
next
response.Write "<font color=green>返回统计:</font><br>"
response.Write "<hr><font color=blue>1)过滤GIF格式图片共"&num_gif&"张</font><br>"&replace(url_gif,"|","<br>")
response.Write "<hr><font color=blue>2)过滤JPG格式图片共"&num_jpg&"张</font><br>"&replace(url_jpg,"|","<br>")
response.Write "<hr><font color=blue>3)过滤PNG格式图片共"&num_png&"张</font><br>"&replace(url_png,"|","<br>")
response.Write "<hr><font color=blue>4)其他格式图片(BMP格式等)共"&num_other&"张</font><br>"&replace(url_other,"|","<br>")

end function

function cutstr(temp,direct,str)
if direct="right" then '剪去标识符右边的内容(包括标识符)
cutstr = left(temp,instr(temp,str)-1)
else '剪去标识符左边的内容(包括标识符)
cutstr = right(temp,len(temp)-instr(temp,str)-len(str)+1)
end if
end function

%>