<!--#include file="conn.asp"-->
<!--#include file="inc/cookies_check.asp"-->
<!--
'*****************************************
'* 软件名称 乐彼网上开店软件(56770 EShop)
'* 软件开发 http://www.56770.com    
'* 版权所有 http://www.56770.com   
'* 文件名称 Admin_update_56770eshop.asp  
'* 最后更新 2010-09-19 by 56770.kingdge 
'*****************************************
--->
<%
admintop()
Dim admin_flag
admin_flag=",10.6,"
if Eshop_Lebi_name="" or instr(","&Eshop_Lebi_flag&",",admin_flag)=0 then
        adminflag()	
Else 
		If OutSubmit = 1 Then CheckOutSubmit()
		Select Case request("action")
			   Case "update" : update()
			   case "del" : del()
			   Case Else
				main()
		End Select
End If 

Sub main()
        filename = Replace(Replace(Lcase(trim(request("filename"))),"/",""),"\","")
        delfilename = Replace(Replace(Lcase(trim(request("delfilename"))),"/",""),"\","")
	If filename="" And delfilename<>"" Then filename = delfilename
%>
<table width="99%" border="0" cellspacing="0" cellpadding="3" class="classtable">
<form action="?action=update" name="form" method="post">
<tr>
  <td colspan="2" height="30" align="right" class="classtd"><input name="submit" type="image" src="lang/<%=LangFilePath%>/images/bt_app.gif" title=" 开始升级 " align="absmiddle">&nbsp;<input type="image" name="del" src="lang/<%=LangFilePath%>/images/bt_delete.gif" value=" 删除文件 " onclick="{if(confirm('确认删除么?')){location.href='?action=del&delfilename=<%= filename %>';}return false;}" align="absmiddle">&nbsp;<input type="image" src="lang/<%=LangFilePath%>/images/bt_bak.gif" border="0" alt=" 返回 " onclick="location.href='javascript:history.back()';return false;" align="absmiddle"></td>
 </tr>
<tr>
<td colspan="2" class="classtop" height="30">56770 Eshop 系统升级模块</strong></td>
</tr>
<tr class="classtd">
<td width="15%" height="30" class="classtd">升级文件：</td>
<td width="85%" class="classtd"><input type="text" size="25" class="form" name="filename" value="<%= filename %>">
</td></tr>
</form>
<tr>
<td colspan="2" class="classfaq">
  <div class="faq_main">
  <p class="faq_title"><%=Lang_sys(49)%></p>
  <font color=red>如何升级?</font>
   <br>将升级文件上传到系统根目录，输入文件名称(无须输入文件路径)按立即升级按钮即可完成升级；升级后请删除升级文件。
   <br><font color=red>如何删除?</font>
   <br>先升级后，按删除文件按钮即可，此功能需要服务器给予FSO权限支持。
  </div>
</td>
</tr>
</table>
<%
End Sub 

Sub Update()
        If OnlyRead = 1 Then OnlyReadMessage()
        filename = Replace(Replace(Lcase(trim(request("filename"))),"/",""),"\","")
		If filename="" Then 
				Update_msg = "<font color=red>出错了：</font>请输入升级文件名称！"
		elseif instr(filename,".asp")<0 Or len(filename)<10 Then 
				Update_msg = "<font color=red>出错了：</font>升级文件名称 <u>"& filename &"</u> 错误！"
		Else     
				Update_msg = "<iframe frameborder=""0"" width=""98%"" height=""300"" scrolling=""yes"" src=""../"& filename &"""></iframe>"
		End If 
        ManageLog "运行升级文件 "& filename &""
        call main()
%>
<table border="0" cellspacing="0" cellpadding="0" align="center" width="100%"><tr><td height="5"></td></tr></table>
<table width="99%" border="0" cellspacing="0" cellpadding="3" class="classtable">
<tr>
<td class="classtop" height="30">56770 Eshop 系统升级进程</td>
</tr>
<tr class="classtd">
<td height="30" class="classtd">	
<%= Update_msg %>
</td></tr>
</table>
<%
End Sub 

Sub del
        If OnlyRead = 1 Then OnlyReadMessage()
        delfilename = Replace(Replace(Lcase(trim(request("delfilename"))),"/",""),"\","")
		If delfilename="" Then 
				Del_msg = "<font color=red>出错了：</font>请输入删除文件名称！"
			Del_ok = "0"
		elseif instr(delfilename,".asp")<0 Then 
				Del_msg = "<font color=red>出错了：</font>删除文件名称 <u>"& delfilename &"</u> 错误！"
			Del_ok = "0"
		elseif len(delfilename)<10 Then 
				Del_msg = "<font color=red>出错了：</font>删除文件名称 <u>"& delfilename &"</u> 错误！"
			Del_ok = "0"
		elseif instr(delfilename,"update")<0 Then 
				Del_msg = "<font color=red>出错了：</font>删除文件名称 <u>"& delfilename &"</u> 错误,该文件名称不被允许删除！"
			Del_ok = "0"
		Elseif instr(delfilename,"update")>0 And instr(delfilename,".asp")>0 Then      
				Del_msg = ""
			Del_ok = "1"
		Else          
				Del_msg = "<font color=red>出错了：</font>删除文件名称 <u>"& delfilename &"</u> 错误,该文件名称不被允许删除！"
			Del_ok = "0"
		End If 
	    call main()
%>
<table border="0" cellspacing="0" cellpadding="0" align="center" width="100%"><tr><td height="5"></td></tr></table>
<table width="99%" border="0" cellspacing="0" cellpadding="3" class="classtable">
<tr> 
<td class="classtop" height="30">删除 56770 Eshop 系统升级文件</td>
</tr>
<tr class="classtd">
<td height="30" class="classtd">	
<%= Del_msg %>
<%
If Del_ok = "1" Then Delfile(delfilename)
%>
</td></tr>
</table>
<%
End Sub  

Function Delfile(str)
        on error resume Next
        ManageLog "删除升级文件 "& str &""
		Dim ObjFSO
		Set ObjFSO = Server.CreateObject("Scripting.FileSystemObject")
		ObjFSO.DeleteFile(Server.MapPath("../"& str &""))
		If Err.Number<>"0" Then
					Response.write "删除失败,请手动在FTP中删除此文件！"
			Response.Write "<br>系统提示：" & Err.Description
		Else
			Response.Write "删除升级文件成功！"
		End If
		Set ObjFSO = Nothing
End Function 
%>