手机站
网通分站
电信主站
密 码:
用户名:
当前位置 : 主页>网络编程>Asp编程>列表

网站图片扫描类

来源:互联网 作者:west263.com 时间:2008-02-23
西部数码-全国虚拟主机10强!40余项虚拟主机管理功能,全国领先!双线多线虚拟主机南北访问畅通无阻!免费赠送企业邮局,.CN域名,自助建站480元起,免费试用7天,满意再付款! P4主机租用799元/月.月付免压金!

Private Function shb(n) '显示字节数
If n<1024 Then
shb = n&"字节"
ElseIf n>1024 and n<1024*1024 Then
shb = formatnumber(n/1024,2)&"K"
ElseIf n>=1024*1024 and n <1024*1024*1024 Then
shb = formatnumber(n/(1024*1024),2)&"M"
Else
shb =formatnumber(n/(1024*1024*1024),2)&"G"
End If
End Function

Private Sub InsDb(RetStr,ReBel,AddNum,PathStr) '分析图片是否有效,并添加到字典对象中
dim chk,ReImg,TheFile
If InStr(RetStr,"0/'>http://")>0 OR Instr(RetStr,"0/'>ftp://")>0 Then
ReImg=RetStr
Chk=-1
Else
RetStr = Replace(RetStr,"/","\")
If (Left(RetStr,1) = "\" ) Then
RetStr=SPath&Retstr
ElseIf Left(RetStr,3) = "..\" Then
dim temp
temp=GetPath(PathStr)
Do Until Left(RetStr,3) <> "..\" '处理相对路径
Temp=Fso.GetParentFolderName(Temp)
RetStr=Mid(RetStr,4,len(RetStr)-3)
Loop
RetStr=Temp&"\"&RetStr
Else
If AddNum=0 Then
if left(RetStr,1)="\" then
RetStr=Path&"\"&Retstr
Else
RetStr=path&Retstr
End If
else
RetStr=getpath(Pathstr)&RetStr
End IF
End If

If FSO.FileExists(RetStr) Then
Chk=1
End If
ReImg=GetFn(RetStr)
End If
If Chk=0 Then
Exists=Exists 1
End if
If File.Exists(ReImg) then
Set TheFile=File.Item(ReImg)
If TheFile.Belong <> ReBel Then
TheFile.Belong=TheFile.Belong&"|"&Rebel
End If
Else
If (List=0 AND Chk =0) OR (List=1 And Chk=-1) Or (List=2 And Chk=1 ) Or List=3 Then
Set TheFile= New FileInfo
TheFile.FileName=ReImg
TheFile.Belong=ReBel
TheFile.Exists=Chk
File.Add ReImg,TheFile
Select Case ScanType
Case 1 Images=Images 1
Case 2 DbImg = DbImg 1
Case Else
If AddNum = 0 Then
DbImg = DbImg 1
Else
Images=Images 1
End If
End Select
End If
End If
End Sub

Private Function GetPath(Str) '获得文件路径
'response.write str&"<br>"
Dim Temp,EndB
Temp=Replace(Str,"/","\")
EndB=InstrRev(Temp,"\")
If EndB = 0 Then
GetPath=SPath
Else
GetPath=Left(Temp,EndB)
End If
'response.write GetPath&"<BR>"
End Function

Private Function GetFn(Str) '获得文件的相对路径名
Dim Temp
Temp=Str
'response.write temp&"<br>"
Temp=Replace(Str,SPath,"")
Temp=Replace(Temp,"\","/")
GetFn=Temp
End Function

End Class

Class FileInfo

Dim FileName,Belong,Exists

Private Sub Class_Initialize
FileName=""
Belong=""
Exists=""
End sub

End Class
%>
应用举例
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%

%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<link rel="stylesheet" href="css.css">
</head>

<body>
<form name="form1" method="post" action="scan.asp">
<table width="60%" border="0" align="center" cellspacing="1" bgcolor="#003366">
<tr bgcolor="#FFFFFF">
<td height="30" colspan="2" bgcolor="#00CCFF"><div align="center">扫描图片</div></td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="26%" height="20"><div align="right">扫描文件夹:</div></td>
<td width="74%" height="20"><select name="Path" id="Path">
<option value="/">/</option>
<%
dim fso,f,fd,p
p=server.MapPath("/")
set fso=Server.CreateObject("Scripting.FileSystemObject")
function showpath(str)
set f=fso.getfolder(str)
set fd=f.subfolders
for each fds in fd
Response.Write "<option value="&Replace(Replace(fds,p,""),"\","/")&">"&Replace(Replace(fds,p,""),"\","/")&"</option>"
set ff=fso.getfolder(fds)
set ffd=ff.subfolders
if ffd.count>0 then
showpath(fds)
end if
next
end function
showpath(p)%>
</select></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="20"><div align="right">扫描类型:</div></td>
<td height="20"><input type="radio" name="SType" value="0">
所有
<input name="SType" type="radio" value="1" checked>
扫描文件
<input type="radio" name="SType" value="2">
扫描数据库</td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="20"><div align="right">显示类型:</div></td>
<td height="20"><input name="LType" type="radio" value="0" checked>
失效
<input type="radio" name="LType" value="1">
网络路径
<input type="radio" name="LType" value="2">
有效
<input type="radio" name="LType" value="3">
所有</td>

文章整理:西部数码--专业提供域名注册虚拟主机服务
http://www.west263.com
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!