<!--#include file="Conn.asp"--><%Checklogin("")%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>管理区域</title>
<link rel="stylesheet" href="css/common.css" type="text/css" />
<script language="javascript" src="js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="js/js.js"></script>
</head>

<body>
<div id="man_zone">
<%
Act = Request.QueryString("act")

If Act="postchk" Then

cpid=Request.QueryString("cpid")
Keys = Server.UrlEnCode(Request.QueryString("Keys"))
Ord = Server.UrlEnCode(Request.QueryString("Ord"))
Page = Request.QueryString("Page")
chkact = Request.Form("chkact")
Set Rsd=Server.CreateObject("ADODB.RecordSet")
Set fs=Server.CreateObject("Scripting.FileSystemObject")
For i = 1 To Request.Form("chkbox").Count
	Response.Write Request.Form("chkbox")(i)
	Rsd.Open "Select picurl From pic Where id="&Request.Form("chkbox")(i),Conn,1,3
	If Not Rsd.Bof And Not Rsd.Eof Then
	If Left(Rsd(0),8)="/System/" Then 
	delfile = Server.MapPath(Rsd(0))
	If fs.FileExists(delfile) Then
    	fs.DeleteFile Server.MapPath(Rsd(0)),True
	End If
	End If
	Rsd.Delete
	End If
	Rsd.Close
Next
Set fs=Nothing:Set Rsd=Nothing:Conn.Close:Set Conn=Nothing

Response.Redirect "?Keys="&Keys&"&Ord="&Ord&"&Page="&Page&"&cpid="&cpid

End If	'End postchk


cpid=Request.QueryString("cpid")
Page = Request.QueryString("Page")
Keys=Server.UrlEnCode(Request.QueryString("Keys"))
Ord=Server.UrlEnCode(Request.QueryString("Ord"))
If cpid="" Or Not IsNumeric(cpid) Then Response.Redirect "products.asp"
Set Rs=Server.CreateObject("ADODB.RecordSet")
Rs.Open "Select id,picurl From pic Where cpid="&cpid&" Order By Id Desc",Conn,1,1
%>
<form method="post" name="form2" action="picupload2.asp?cpid=<%=cpid%>&Page=<%=Page%>&Keys=<%=Keys%>&Ord=<%=Ord%>" enctype="multipart/form-data" onsubmit="if(this.filedata.value==''){return false;}" style="margin-bottom:10px;">
	<input type="file" name="filedata" id="filedata" style="float:left;height:22px;border:1px solid #DBE6E3;background:#FFF;width:330px;" /><input type="submit" value="上传" class="btn1" style="margin-left:10px" />
</form>
<form id="form1" method="post" action="?act=postchk&cpid=<%=cpid%>&Page=<%=Page%>&Keys=<%=Keys%>&Ord=<%=Ord%>" onSubmit="return false" />
	<table width="100%" border="0" cellpadding="3" cellspacing="1" class="table1">
		<thead>
			<tr>
				<th width="4%"><input type="checkbox" name="chkall" id="chkall" onClick="chkboxall(this,'chkbox')" /></th>
				<th width="6%">序号</th>
				<th width="35%">缩略图</th>
			</tr>
		</thead>
		<tbody>
<%
If Not Rs.Bof And Not Rs.Eof Then
Tempnum=0
Do While Not Rs.Bof And Not Rs.Eof

		TempNum=TempNum+1
%>
			<tr onMouseOver="this.style.background='#F7FCFF'" onMouseOut="this.style.background='#FFFFFF'">
				<td align="center"><input type="checkbox" name="chkbox" value="<%=Rs(0)%>" /></td>
				<td align="center"><%=TempNum%></td>
				<td align="center"><img src="<%=Rs(1)%>" height="50" /></td>
			</tr>
<%
Rs.MoveNext
Loop
Else
%>
			<tr>
				<td align="center" colspan="3">当前还没有图片</td>
			</tr>
<%
End If
%>
		</tbody>
		<tfoot>
			<tr>
				<td colspan="3">
					<div class="postchkbox">
						<select id="chkact" name="chkact">
							<option value="-1">删除</option>
						</select>
						<input type="button" value="执行" onClick="postchk(1)" class="btn1" />
						<input type="button" value="返回" onClick="location.href='cp2.asp?Keys=<%=Keys%>&Ord=<%=Ord%>&Page=<%=Page%>&act=edit&id=<%=cpid%>'" class="btn1" />
					</div>
				</td>
			</tr>
		</tfoot>
	</table>
</form>
<%Rs.Close:Set Rs=Nothing:Conn.Close:Set Conn=Nothing%>
</div>
</body>
</html>
