<% data_path="../" 'ACC连接数据库路径，对SQL无效 %>
<!--#include file="../conn/conn.asp"-->
<!--#include file="../inc/filesystem.asp"-->
<!--#include file="../inc/safe.asp"-->
 <!--#include file="checkrole.asp"-->
<%
call checkuser("ts")

	if issession=0 then
	username=Replace_Text(request.Cookies("Yxmember"))
	gsid=Replace_Text(request.Cookies("Yxmemberid"))
	else
	username=session("user")
	gsid=session("id")
	end if 
sql="select * from Websen_corporation where id="&gsid&""
Set rs= Server.CreateObject("ADODB.Recordset") 
rs.open sql,conn,1,1
qyjj=rs("qyjj")
 
  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 Websen_files where userid="&gsid&" and fileid="&arrid(i)
		rsr.open exec,conn,1,1
		if not rsr.eof then
 		if rsr("fileurl")<>"" then
  			 call FileDel(HOPE_InstallDir&"vipcom/"&username&"/"&rsr("fileurl")) 
 		end if
		end if
		Conn.execute("delete  from Websen_files where userid="&gsid&" and 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">
</head>
<BODY style="margin:0px;">


<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#F6F6F6">
<tr><td  height="40" colspan="2" align="center" bgcolor="#EFEFEF"><strong>〖<font color="red"><%=username%></font>〗的统一文件上传管理</strong></td>
</tr>
<!--控制空间限制--->
<tr><td colspan="2" align="center">你的总空间大小为
<font color="red"><%
othersize=0
set rsuf=server.CreateObject("adodb.recordset")
sqluf="select foldersize from Websen_corporation where id="&gsid
rsuf.open sqluf,conn,1,1
if not rsuf.eof then
othersize=rsuf("foldersize")
response.Write(rsuf("foldersize"))
end if
%></font>KB,
空间已用<font color="red">
<%
if FunFolderSize(HOPE_InstallDir&"vipcom/"&username)>=othersize then
%>
 <%=othersize%>
<%
else
%>
 <%=FunFolderSize(HOPE_InstallDir&"vipcom/"&username)%>
<%
end if

%>
</font>KB，还剩<font color="red">
<%
if round(othersize-FunFolderSize(HOPE_InstallDir&"vipcom/"&username),2)<=0 then
%>
<%=0%>
<%
else
%>
<%=round(othersize-FunFolderSize(HOPE_InstallDir&"vipcom/"&username),2)%>
<%
end if
%>
</font>KB<br><font color="#999999">(提示：为节省空间请上传尽量小的图片！)</font><br><hr size="1" align="center" color="#BB130B" noshade="noshade"></td></tr>
 
<!--控制空间限制--->

<script language="javascript">
function checknull()
{
var str=document.form.wjname.value;
if(str.replace(/^\s+|\s+$/g,'')=="")
{
alert("请输入文件名称！");
document.form.wjname.focus();
return false;
}
var strs=document.form.picture.value;
if(strs.replace(/^\s+|\s+$/g,'')=="")
{
alert("请输入图片的路径！");
document.form.picture.focus();
return false;
}
 }
</script>

 <!--进行空间大小限制^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-->
 <%
 if  (othersize-FunFolderSize(HOPE_InstallDir&"vipcom/"&username))>0 then
 %>
 <form name="form" method="post" action="myfiles_ok.asp"  onSubmit="return checknull();">
<tr><td colspan="2"  align="center" height="25"><font   color="red"><b><%=Replace_Text(Request("msg"))%></b></font></td></tr>
<tr>
<td height="30" align="center">
上传文件的名称：</td>
<td><input  type="text" name="wjname" maxlength="20" value=""  onblur="this.value=this.value.replace(/\s/igm,'')">
</td></tr>
 		<tr><td align="center"> 上传文件：<!----------------------------------------------------文件上传----------------------------------------------->
 </td><td> <br><iframe id="d_file" frameborder="0" src="../inc/upload.asp?tMode=5&istwo=0&utype=guser&guser=<%=username%>" width="300" height="40" scrolling="no"></iframe>
  <!---------------------------------------------------------------------------></td></tr>
  <tr><td align="center">上传的图片的路径:</td><td>
<br><input type="text"  name="picture" value="" onBlur="this.value=this.value.replace(/\s/igm,'')" maxlength="100" readonly>
</td></tr><tr><td></td><td align="left"  >
<br><input type="submit" name="gos" value="我要保存"> &nbsp;&nbsp; <a href="myfiles.asp">重新上传</a>

</td></tr>
</form>
 <%
 else
  response.Write("<tr><td colspan=2  align=center>对不起！你的空间已满！<td></tr>")
end if
%>
 <!--进行空间大小限制^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-->

</table><br>
<table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0" class="tab02">
  
  <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=43%>文件名</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 * from Websen_files where userid="&gsid&" and [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 not isnumeric(page) then
				 page=1
				 end if
				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
				  response.Write(right(rs("fileurl"),3))
				  
				  %></td>
                  <td> <a href="<%="../vipcom/"&username&"/"&rs("fileurl")%>" target=_blank><%=rs("wjname")%></a></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=6 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>
        <%
		Response.Write "<script>parent.form.draw.value='"&HOPE_InstallDir&"Uploadfile/AD/"& File.FileName&"';</script>"
  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 "</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>
<BR>
<table border="0" cellpadding="0"   width="100%"  align="center"><tr><td align="center"><a href="javascript:window.close();" >关闭</a></td></tr></table>
</BODY></HTML>
<%

conn.close
set conn=nothing
%>