⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 admin_beifen.asp

📁 功能最强大的ASP网站
💻 ASP
字号:
<!--#include file="conn.asp"-->
<!--#include file="fso.asp"-->
<!--#include file="setting.asp"-->
<%
dim action
dim admin_flag

Function finddir(filepath)
	finddir=""
	for i=1 to len(filepath)
	if left(right(filepath,i),1)="/" or left(right(filepath,i),1)="\" then
	  abc=i
	  exit for
	end if
	next
	if abc <> 1 then
	finddir=left(filepath,len(filepath)-abc+1)
	end if
end Function


	action=trim(request("action"))

dim dbpath,bkfolder,bkdbname,fso,fso1
Dim uploadpath

	'备份数据

select case action
case "BackupData"		'备份数据
		if request("act")="Backup" then
			call updata()
		else
			call BackupData()
		end if

case "RestoreData"		'恢复数据
	dim backpath
		if request("act")="Restore" then
			Dbpath=request.form("Dbpath")
			backpath=request.form("backpath")
			if dbpath="" then
			response.write "请输入您要恢复成的数据库全名"	
			else
			Dbpath=server.mappath(Dbpath)
			end if
			backpath=server.mappath(backpath)
		
			Set Fso=server.createobject("scripting.filesystemobject")
			if fso.fileexists(dbpath) then  					
			fso.copyfile Dbpath,Backpath
			response.write "<br>"
			response.write "<br>"
			response.write "<br>"
			response.write "<center>成功恢复数据!"
			response.write "</center>"			
			else
			response.write "备份目录下并无您的备份文件!"	
			end if
		else
		
			call RestoreData()
		end if
end select


sub BackupData()
If IsSqlDataBase = 1 Then
	SQLUserReadme()
	Exit Sub
End If
%>

<link href="css/css.css" rel="stylesheet" type="text/css">
<body>
	<div align="center" class="STYLE3">
	<table border="0"  cellspacing="1" cellpadding="5" height="1" width="80%" class="STYLE3">
  				<tr>
  					<th height=20 >
  					  <span class="STYLE11">&nbsp;&nbsp;<B>备份数据</B>( 需要FSO支持,FSO相关帮助请看微软网站 )  					</span></th>
  				</tr>
  				<form method="post" action="admin_beifen.asp?action=BackupData&act=Backup">
  				<tr>
  					<td height=20 class="forumrow STYLE11">
				   </td>
  				</tr>	
  				<tr>
  					<td height=20 class="forumrow STYLE11">
  						&nbsp;当前数据库路径(相对路径):<input type=text size=45 name=DBpath value="<%=finddir(request.servervariables("URL"))%>date/#shangdu.mdb"></td>
  				</tr>	
  				<tr>
  					<td height=20 class="forumrow STYLE11">
  						&nbsp;备份数据库目录(相对路径):<input type=text size=45 name=bkfolder value=date>
  						&nbsp;<br>
&nbsp;<font color="#FF0000">如目录不存在,程序将自动创建</font></td>
  				</tr>	
  				<tr>
  					<td height=20 class="forumrow STYLE11">
  						&nbsp;备份数据库名称(填写名称):<input type=text size=45 name=bkDBname value=#shangdu1.mdb>
  						&nbsp;<br>
&nbsp;<font color="#FF0000">如备份目录有该文件,将覆盖,如没有,将自动创建</font></td>
  				</tr>	
  				<tr>
  					<td height=20 class="forumrow">
  						<p align="center" class="STYLE16">
						<input type=submit class="STYLE17"  value="备份数据"></td>
  				</tr>	
  				</form>
	  </table>
</div>
    <span class="STYLE3">
    <%
end sub

sub updata()
		Dbpath=request.form("Dbpath")
		Dbpath=server.mappath(Dbpath)
		bkfolder=request.form("bkfolder")
		bkdbname=request.form("bkdbname")
		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
			end if
			response.write "<br>"
			response.write "<br>"
			response.write "<br>"						
			response.write "<center>备份数据库成功,您备份的数据库路径为 服务器空间的:" &bkfolder& "\"& bkdbname
			response.write "</center>"
		Else
			response.write "找不到您所需要备份的文件。"
		End if
end sub

sub RestoreData()

%>
    </span>
<div align="center" class="STYLE7">
<table  height="160" width="80%" class="STYLE3">
	<th height=20 >
   					<span class="STYLE11">&nbsp;&nbsp;<B>恢复数据</B>( 需要FSO支持 )	  </span></th>
  				</tr>
				<form method="post" action="admin_beifen.asp?action=RestoreData&act=Restore">
  				
  				<tr>
  					<td height=20 class="forumrow STYLE16">
				   </td>
  				</tr>	
  				
  				<tr>
  					<td height=20 class="forumrow STYLE11 STYLE11">
  						&nbsp;备份数据库路径(相对):<input type=text size=30 name=DBpath value="date\#shangdu1.mdb">
  						&nbsp;</td>
  				</tr>	
  				
  				<tr>
  					<td height=20 class="forumrow STYLE11 STYLE11">
  						&nbsp;目标数据库路径(相对):<input type=text size=30 name=backpath value="date\#shangdu.mdb"></td>
  				</tr>	
  				
  				<tr>
  					<td class="forumrow">
  						<span class="STYLE11 STYLE11"><font color="#FF0000"> &nbsp;填写您当前使用的数据库路径,如不想覆盖当前文件,可自行命名(注意路径是否正确)</font></span></td>
  				</tr>	
  				<tr>
  					<td class="forumrow">
  						<p align="center">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type=submit class="STYLE7" value="恢复数据">
  					</td>
  				</tr>
  				</form>
  </table>
</div>

<span class="STYLE3">
<%
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)
	dim f
    Set fso1 = CreateObject("Scripting.FileSystemObject")
        Set f = fso1.CreateFolder(foldername)
        MakeNewsDir = True
    Set fso1 = nothing
End Function
%> 
</span>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -