 <% 
	data_path="../" 'ACC连接数据库路径，对SQL无效
	numid="no"
	dir="no" 
  %>
<!--#include file="../conn/conn.asp"-->
<!--#include file="../inc/filesystem.asp"--> 
<!--#include file="../inc/safe.asp"-->
 <!--#include file="rolecheckout.asp"-->


<% dim rsr
If request("action")="del" then
	dim id
	id=replace(request("id"),"'","")
	arrid=split(id,",")
	for i=0 to ubound(arrid)
		set rsr=server.CreateObject("adodb.recordset")
		exec="select fileurl from yixiang_files where fileid="&arrid(i)
		rsr.open exec,conn,1,1
		if rsr("fileurl")<>"" then
			set fso=YXFSO
			on error resume next
			fso.deletefile server.mappath(rsr("fileurl"))
		end if
		Conn.execute("delete  from yixiang_files where fileid="&arrid(i))
	next

End If
%>
<SCRIPT language=javascript>
function check() 
{
	var wjname=document.form.wjname.value;
	var strFileName=document.form.FileName.value;
	if (wjname=="")
	{
    	alert("请输入文件名称");
		document.form.wjname.focus();
    	return false;
  	}
	if (strFileName=="")
	{
    	alert("请选择要上传的文件");
		document.form.FileName.focus();
    	return false;
  	}
}
</SCRIPT>
<script language="JavaScript">
<!--
function CheckAll(form) {
for (var i=0;i<form.elements.length;i++) {
var e = form.elements[i];
if (e.name != 'chkall') e.checked = form.chkall.checked; 
}
}
//-->
</script>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>欢迎光临商务助手管理平台</title>
<link href="images/css.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
body {
	background-color: #cad7f7;
}
-->
</style></head>
<BODY leftMargin=0 topMargin=0 marginheight="0" marginwidth="0">
<table width="98%"  border="0" align="center" class="tab02">
  <tr>
    <td><form action="myfiles_ok.asp" method="post" style="margin:0" name="form" onSubmit="return check()" enctype="multipart/form-data">
      <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#6A98CA">
        <tr>
          <td height="22" colspan="2" bgcolor="#6392C6">&nbsp;<span style="font-size:13px;color:#FFFFFF;font-weight:bold"> 管理中心 -&gt; 上传文件管理 </span></td>
        </tr>
        <tr>
          <td height="15" colspan="2" bgcolor="#FFFFFF"><span style="line-height:150%">可上传类型：jpg,swf,gif,bmp,png,psd,cdr,rar,ppt,doc,xls,zip<br>
              </span></td>
        </tr>
        <tr valign="baseline">
          <td width="126" align="right" nowrap bgcolor="#FFFFFF">文件名称:&nbsp;</td>
          <td width="594" bgcolor="#FFFFFF"><input name="wjname" type="text" class="bg2" id="wjname" value="" size="20" maxlength="20"></td>
        </tr>
        <tr valign="baseline">
          <td align="right" nowrap bgcolor="#FFFFFF">选择路径：</td>
          <td bgcolor="#FFFFFF"><input name="FileName" type="FILE" size="30" style="width:300;height:22"></td>
        </tr>
        <tr valign="baseline">
          <td align="right" nowrap bgcolor="#FFFFFF">&nbsp;</td>
          <td bgcolor="#FFFFFF"><label>
            <input type="submit" name="Submit3" value="上传保存" <%	if mbed>102400 then Response.write "disabled" %>>
            <input type="reset" name="Submit32" value="重新设置">
          </label></td>
        </tr>
      </table>
    </form></td>
  </tr>
  <tr>
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height=25 bgcolor=#ADD7F7>　　<font style="font-weight:bold;color:#FFFFFF;font-size:13px">文件管理</font></td>
      </tr>
      <tr>
        <td bgcolor=#ffffff height=25><table width="100%" border="0" cellspacing="1" cellpadding="5" align=center bgcolor=#0099CC>
          <form name="filefrom" method="post" action="">
            <input name="action" type="hidden" value="del">
            <tr bgcolor=#efefef align=center>
              <td width="6%"><img src="../file_ico/islx.gif" alt="文件属性" width="16" height="16" align=absmiddle></td>
              <td width=21%>文件名</td>
              <td width=22%>所属会员</td>
              <td width=14%>大小(KB)</td>
              <td width="25%">上传时间</td>
              <td width="6%"><img src="../file_ico/isok.gif" alt="文件是否存在" width="16" height="16" align=absmiddle></td>
              <td width="6%"><input name="chkall" type="checkbox" id="chkall" value="select" onClick="CheckAll(this.form)" style="border:0"></td>
            </tr>
            <% dim sql,rs,fs
					sql="select yixiang_files.*,Yixiang_corporation.[User] from yixiang_files inner join [Yixiang_corporation] on Yixiang_corporation.id=yixiang_files.userid where [check]=1 order by addtime desc"
set rs=server.createobject("adodb.recordset")                     
rs.open sql,Conn,1,1                     
If Not rs.eof Then
				dim page,MaxPerPage,filetype,filesize,i
				 MaxPerPage=10
				 page=request("page")
				if page="" then page=1
				rs.pagesize=MaxPerPage
				rs.absolutepage=page
				i=0
				Do While not rs.eof	and i<rs.pagesize
				i=i+1
				filetype=split(rs("fileurl"),".")
				%>
            <tr bgcolor=#ffffff>
              <td align=center><% Set fs = YXFSO
					If Fs.fileExists(server.mappath("../file_ico/"&filetype(1)&".gif")) Then
						response.write "<img src=""../file_ico/"&filetype(1)&".gif"" width=16 align=absmiddle alt='"&filetype(1)&" 文件格式'>"
					else
						response.write "<img src=""../file_ico/x.gif"" align=absmiddle alt='"&filetype(1)&" 文件格式'>"
					end if
					%></td>
              <td><a href="<%=rs("fileurl")%>" target=_blank><%=rs("wjname")%></a></td>
              <td align="center"><%=rs("user")%></td>
              <%filesize=round(rs("filesize")/1024,2)%>
              <td align=right><%if filesize<1 then response.write "0"&filesize else response.write filesize%></td>
              <td align="center" bgcolor="#ffffff"><%=rs("addtime")%></td>
              <td align=center><% If Fs.fileExists(server.mappath(rs("fileurl"))) Then
						response.write "<img src=../file_ico/isok.gif align=absmiddle alt='此文件存在'>"
						Else
						Response.write "<font colo=red>×</font>"
						End if
						set fs =nothing
						%>              </td>
              <td align=center><input type="checkbox" name="ID" value="<%=rs("fileid")%>" style="border:0"></td>
            </tr>
            <% rs.movenext 
					loop %>
            <tr>
              <td colspan=7 align=right bgcolor=#efefef height=20><input type="submit" name="Submit4" value="删 除" class=input1 style="height:18"></td>
            </tr>
            <% else
				Response.write "<tr><td colspan=6 align=cneter bgcolor=#efefef height=20>暂无上传文件</td></tr>"
				end if %>
          </form>
        </table></td>
      </tr>
      <%
		  sub page_show()
dim filename
filename=request.ServerVariables("SCRIPT_NAME")
response.write "<form name=frm_page action="&filename&" method=get style=margin:0>"
response.write "每页<font color=red>"&rs.pagesize&"</font>条"
response.write "/共<font color=red>"&rs.recordcount&"</font>条&nbsp;&nbsp;"
response.write "第<font color=red>"&page&"</font>页/共<font color=red>"&rs.pagecount&"</font>页&nbsp;"
if page>1 then
response.write "【<a href=?page=1>首 页</a>】"
response.write "【<a href=?page="&int(page-1)&">上 页</a>】"
else
response.write "【<font color=#999999>首 页</font>】"
response.write "【<font color=#999999>上 页</font>】"
end if
if int(page)<rs.pagecount then
response.write "【<a href=?page="&int(page+1)&">下 页</a>】"
response.write "【<a href=?page="&rs.pagecount&">末 页</a>】&nbsp;"
else
response.write "【<font color=#999999>下 页</font>】"
response.write "【<font color=#999999>末 页</font>】&nbsp;"
end if
response.write "转到 <input name=page type=text id=page size=2 maxlength=4 value="&page&"> 页 "
response.write "<input name=gopage type=submit id=gopage value=GO>"
response.write "</form>"
end sub
		  if i>0 then
	   		  Response.Write "<tr><td colspan=10 height=25 bgcolor='#ffffff' align=right>"
		  call page_show()
		  response.write "</td></tr>"
		  end if
		  rs.close
		  set rs=nothing
		  %>
    </table></td>
  </tr>
</table>
</BODY></HTML>
<%

conn.close
set conn=nothing
%>