

<!--#include file="conn.asp"-->
<%
if session("admin")="" then
conn.close
set conn = nothing
response.Write "<script language='javascript'>alert('请先登录！');location.href='index.asp' ;</script>"
response.End
else
if request.cookies("sundxshop")("admin")="" then
conn.close
set conn = nothing
response.Write "<script language='javascript'>alert('请先登录！');location.href='index.asp' ;</script>"
response.End
end if
end if
if session("rank")>1 then
conn.close
set conn = nothing
response.Write "<script language='javascript'>alert('你无权删除图片！');history.go(-1);</script>"
response.End
end if
%>
<title>删除图片管理</title>


<% 

'以下为修改内容 

Const UploadDir = "../images/proupfile/" '存放文件的目录 
Const UploadDir1 = "images/proupfile/" 
Const MaxPerPage = 50 '每页显示数量 



'检查组件是否已经安装 

Function IsObjInstalled(strClassString) 



IsObjInstalled = False 

Err = 0 

Dim xTestObj 

Set xTestObj = Server.CreateObject(strClassString) 

If 0 = Err Then IsObjInstalled = True 

Set xTestObj = Nothing 

Err = 0 



End Function 



Dim strFileName 

Dim totalPut,CurrentPage,TotalPages 

Dim TruePath,Fso,theFolder,theFile,whichfile,thisfile,FileCount,TotleSize 

strFileName = "?" 



If Request("page") <> "" Then 

CurrentPage = CInt(Request("page")) 

Else 

CurrentPage = 1 

End If 



TruePath = Server.MapPath(UploadDir) 

If IsObjInstalled("Scripting.FileSystemObject") = False Then 

Response.Write "<b><font color=""red"">你的服务器不支持 FSO(Scripting.FileSystemObject)! 不能使用本功能</font></b>" 

Else 

Set Fso = Server.CreateObject("Scripting.FileSystemObject") 

%> 

<html> 

<head> 

<title>产品图片列表</title> 

<meta http-equiv="Content-Type" content="text/html; charset=gb2312"> 

<link rel="stylesheet" href="../skin/skin01.css" type="text/css"> 

<style type="text/css"> 

<!-- 

body { 

margin :0px;font-size: 9pt 

} 

.font { 

font-size: 12px; 

color: #000000; 

text-decoration: none; 

text-align: center; 

vertical-align: middle; 

line-height: 140%; 

} 

table,td { 

font-size: 9pt 

} 

--> 

</style> 

</head> 

<body bgcolor="#39867B" text="#000000" topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0"> 

<div align=center> 



<table width="98%" border="0" bgcolor="#39867B" cellspacing="1" cellpadding="0" align="center"> 
<tr  bgcolor="#ffffff"> 

<td  align="center" valign="top"> 
<a href=admin_delpropic.asp>所有图片列表  </a>
</td> <td width="20%" align="center" valign="top"> 

</td> 
</tr> 

</table> 
<tr  bgcolor="#ffffff"> 

<td  align="center" valign="top"> 

<% 

If Fso.FolderExists(TruePath) Then 

FileCount = 0 

TotleSize = 0 

Set theFolder = Fso.GetFolder(TruePath) 

For Each theFile In theFolder.Files 

FileCount = FileCount + 1 

TotleSize = TotleSize + theFile.Size 

Next 

totalPut = FileCount 

If CurrentPage < 1 Then 

CurrentPage = 1 

End If 



If (CurrentPage - 1) * MaxPerPage > totalPut Then 

If (totalPut Mod MaxPerPage) = 0 Then 

CurrentPage = totalPut \ MaxPerPage 

Else 

CurrentPage = totalPut \ MaxPerPage + 1 

End If 



End If 

If CurrentPage = 1 Then 

showContent 

showpage2 strFileName,totalput,MaxPerPage 

Response.Write "<br><div align=""center"">本页共显示 <b>" & FileCount - 1 & "</b> 个文件，占用 <b>" & TotleSize\1024 & "</b> K</div>" 

Else 

If (CurrentPage - 1) * MaxPerPage < totalPut Then 

showContent 

showpage2 strFileName,totalput,MaxPerPage 

Response.Write "<br><div align=""center"">本页共显示 <b>" & FileCount-1 & "</b> 个文件，占用 <b>" & TotleSize\1024 & "</b> K</div>" 

Else 

CurrentPage=1 

showContent 

showpage2 strFileName,totalput,MaxPerPage 

Response.Write "<br><div align=""center"">本页共显示 <b>" & FileCount-1 & "</b> 个文件，占用 <b>" & TotleSize\1024 & "</b> K</div>" 

End If 

End If 

Else 

Response.Write "找不到文件夹！可能是配置有误！" 

End If 

End If 



'定义过程列出图片 

Sub showContent() 

Dim c 

FileCount = 1 

TotleSize = 0 

%> 

<table width="98%" border="0" bgcolor="#39867B" cellspacing="1" cellpadding="0" align="center"> 

<tr bgcolor="#ffffff"> 

<% 

For Each theFile In theFolder.Files 

c = c + 1 

If FileCount > MaxPerPage Then 

Exit For 

ElseIf c > MaxPerPage * (CurrentPage - 1) Then 

%> 

<td align="center"> 

<a href="<%=(UploadDir & theFile.Name)%>" target="_blank"><img src="<%=(UploadDir & theFile.Name)%>" border="0" width="50" height="50"></a> <br>

<a style="cursor: hand" href="admin_delpropicok.asp?filename=<%=theFile.Name%>&page=<%=CurrentPage%>" onclick="javascript: return confirm('您确定删除吗?')">删除</a> 
<%
set rs=server.CreateObject("adodb.recordset")
rs.open "select id,pic,pic1,pic2,photo from product where pic like '%"&(UploadDir1 & theFile.Name)&"%' or pic1 like '%"&(UploadDir1 & theFile.Name)&"%' or pic2 like '%"&(UploadDir1 & theFile.Name)&"%' or photo like '%"&(UploadDir1 & theFile.Name)&"%'",conn,1,1
if not rs.eof and not rs.bof then%>
有效

<%else%>
<font color="blue">垃圾</font>
<%rs.close
end if
%> 
</td> 

<% 

If FileCount Mod 10 = 0 Then 

%> 

</tr> 

<tr bgcolor="#ffffff"> 

<% 

End If 

FileCount = FileCount + 1 

TotleSize = TotleSize + theFile.Size 

End If 

Next 

%> 

</tr> 

</table> 

<% 

End Sub 

%> 

</td> 

</tr> 

</table> 

</div> 

</body> 

</html> 

<% 

Sub showpage2(sfilename,totalnumber,MaxPerPage) 

Dim n, i,strTemp 

If (totalnumber Mod MaxPerPage) = 0 Then 

n = totalnumber \ MaxPerPage 

Else 

n = totalnumber \ MaxPerPage + 1 

End If 

strTemp = "<table width=""98%"" border=""0"" bgcolor=""#39867B""  cellspacing=""1"" cellpadding=""0"" align=""center"">" 

strTemp = strTemp & vbCrLf & " <form name=""showpages"" method=""get"" action=""" & sfilename & """>" 

strTemp = strTemp & vbCrLf & " <tr bgcolor=""#ffffff"">" 

strTemp = strTemp & vbCrLf & " <td align=""right"">" 

strTemp = strTemp & "共 <b>" & totalnumber & "</b> 个文件&nbsp;&nbsp;" 

If CurrentPage < 2 Then 

strTemp = strTemp & "首页 上一页&nbsp;" 

Else 

strTemp = strTemp & "<a href=""" & sfilename & "page=1"">首页</a>&nbsp;" 

strTemp = strTemp & "<a href=""" & sfilename & "page=" & (CurrentPage - 1) & """>上一页</a>&nbsp;" 

End If 



If n - CurrentPage < 1 Then 

strTemp = strTemp & "下一页 尾页" 

Else 

strTemp = strTemp & "<a href=""" & sfilename & "page=" & (CurrentPage + 1) & """>下一页</a>&nbsp;" 

strTemp = strTemp & "<a href=""" & sfilename & "page=" & n & """>尾页</a>" 

End If 

strTemp = strTemp & "&nbsp;页次：<strong><font color=""red"">" & CurrentPage & "</font>/" & n & "</strong>页 " 

strTemp = strTemp & "&nbsp;<b>" & MaxPerPage & "</b>" & "个文件/页" 

strTemp = strTemp & vbCrLf & "&nbsp;转到：<select name=""page"" size=""1"" onchange=""javascript:submit()"">" 

For i = 1 To n 

strTemp = strTemp & vbCrLf & "<option value=""" & i & """" 

If CInt(CurrentPage) = CInt(i) Then strTemp = strTemp & " selected " 

strTemp = strTemp & ">第" & i & "页</option>" 

Next 

strTemp = strTemp & vbCrLf & " </select>" 

strTemp = strTemp & vbCrLf & " </td>" 

strTemp = strTemp & vbCrLf & " </tr>" 

strTemp = strTemp & vbCrLf & " </form>" 

strTemp = strTemp & vbCrLf & "</table>" 

Response.Write strTemp 

End Sub 

%> 







<!--#include file="footer.asp"-->