www.gusucode.com > 艺帆全站DIV+CSS体育用品公司网站源码 1.7.5源码程序 > i5808/Manage_backup.asp

    <!--#include file="../Conn.asp" -->
<!--#include file="seeion.asp"-->  
<!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>
<title>备份数据库</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" id="css" href="images/style.css">
</head>
<body>
<table width="100%" height="97%" border="0" cellpadding="0" cellspacing="0">
  <tr> 
    <td align="center" valign="top"><table width="99%" border="0" align="center" cellpadding="0" cellspacing="1" >
       <form method="post" action="Manage_backup.asp?action=Backup">
        <tr>
          <td height="30" background="images/bg_list.gif"><div  style="padding-left:10px; font-weight:bold; color:#FFFFFF; text-align:left">备份数据库</div></td>
        </tr>
        <tr>
          <td bgcolor="#FFFFFF"><span class="back_southidc">
            <%
if request("action")="Backup" then
call backupdata()
else
%>
            </span>
            <table width="100%" border="0" align="center" cellpadding="5" cellspacing="0" >
              <tr onmouseover="style.backgroundColor='#EEEEEE'" onmouseout="style.backgroundColor='#F1F5F8'" bgcolor="#F1F5F8" >
                <td height="25" width="30%" class="td"><div align="left">当前数据库路径</div></td>
                <td width="70%"  class="td">
                  <div align="left">
                    <input type="text" size="30" name="DBpath" value="../OneFCMS_Data/OneFCMS$%#$#Data$%#2012#$11$$#7.mdb" />                  
                    <input type="hidden" size="50" name="bkfolder" value="Databackup" />                
                  </div></td>
              </tr>
              <tr onmouseover="style.backgroundColor='#EEEEEE'" onmouseout="style.backgroundColor='#FFFFFF'" bgcolor="#FFFFFF">
                <td height="25" width="30%" class="td"><div align="left">备份数据库名称</div></td>
                <td class="td"><div align="left">
                      <input type="text" size="30" name="bkDBname" value="<%=date()%>.mdb" />
                  [如备份目录有该文件,将覆盖,如沒有,将自动创建]</div></td>
              </tr>
              <tr onmouseover="style.backgroundColor='#EEEEEE'" onmouseout="style.backgroundColor='#F1F5F8'" bgcolor="#F1F5F8">
                <td height="25" width="30%" class="td"><div align="left"></div></td>
                <td class="td"><div align="left">
                  <input type="submit" value="确定备份" class="btn"/>
                </div></td>
              </tr>
          </table></td></tr></form>
      </table>
      <%end if%>
    <% 
sub backupdata() 
Dbpath=request.form("Dbpath") 
Dbpath=server.mappath(Dbpath) 
bkfolder=request.form("bkfolder") 
bkdbname=request.form("bkdbname") 
if InStr(LCase(bkdbname), ".asp") then
Response.Write "<script>alert('备份文件名不能包含ASP字符!');history.go(-1);</script>"
response.end 
end if
Set Fso=server.createobject("scripting.filesystemobject") 
if fso.fileexists(dbpath) then 
If CheckDir(bkfolder) = True Then 
fso.copyfile dbpath,bkfolder& "\"& bkdbname 
else 
MakeNewsDir bkfolder 
fso.copyfile dbpath,bkfolder& "\"& bkdbname & ".mdb"
end if 
response.write("<br/>")
response.write "<left>&nbsp;&nbsp;&nbsp;&nbsp;备份数据库成功,备份的数据库为 " & bkfolder & "\" & bkdbname & "</left><br><br><br><left>&nbsp;&nbsp;&nbsp;&nbsp;<a href=javascript:history.go(-1);><span class=a>【返回继续管理操作】<span></a></left>" 
response.write("<br/>")
response.write("<br/>")
Else 
response.write "找不到您所需要备份的文件。" 
End if 
end sub 
'------------------检查某一目录是否存在------------------- 
Function CheckDir(FolderPath) 
folderpath=Server.MapPath(".")&"\"&folderpath 
Set fso1 = CreateObject("Scripting.FileSystemObject") 
If fso1.FolderExists(FolderPath) then 
'存在 
CheckDir = True 
Else 
'不存在 
CheckDir = False 
End if 
Set fso1 = nothing 
End Function 
'-------------根据指定名称生成目录--------- 
Function MakeNewsDir(foldername) 
Set fso1 = CreateObject("Scripting.FileSystemObject") 
Set f = fso1.CreateFolder(foldername) 
MakeNewsDir = True 
Set fso1 = nothing 
End Function 
%></td>
  </tr>
</table>
</body>
</html>