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

📄 db_restore.asp

📁 SK信息采集2.0功能介绍: 1.可针对任何静态网页,动态网页进行采集。包括htm,html,shtml,ASP,ASPX,JSP,PHP等。 2.增加自定文件采集.用户可采集网页中的所有文件.
💻 ASP
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%option explicit%>
<!--#include file="../../Conn.asp"-->
<!--#include file="../../SysCls/KS_CommonCls.asp"-->
<!--#include file="../Inc/Session.asp"-->
<%
'===================================================================================================================
'软件名称:科汛网站管理系统
'当前版本:科汛网站管理系统 V2.2 SP2 Free
'Copyright (C) 2006-2008 Kesion.Com  All rights reserved.
'产品咨询QQ:9537636,41904294
'技术支持QQ:111394,54004407 
'程序版权:科汛网络
'程序开发:科汛网络开发组(总策划:林文仲)
'E-Mail  :kesioncms@hotmail.com webmaster@kesion.com
'官方网站:http://www.kesion.com  
'演示站点:http://test.kesion.com 
'郑重声明:
'    ①、免费版本请在程序首页保留版权信息,并做上本站LOGO友情连接,商业版本无此要求;
'    ②、任何个人或组织不得在授权允许的情况下删除、修改、拷贝本软件及其他副本上一切关于版权的信息;
'    ③、科汛网络保留此软件的法律追究权利
'===================================================================================================================
Dim KSCls
Set KSCls = New DB_BackUp
KSCls.Execute()
Set KSCls = Nothing

Class DB_BackUp
        Private KSCMS
		Private Sub Class_Initialize()
		  Set KSCMS=New CommonCls
		End Sub
        Private Sub Class_Terminate()
		 Call KSCMS.CloseConn()
		 Set KSCMS=Nothing
		End Sub
		Sub Execute()
		   If Not KSCMS.ReturnPowerResult(0, "KMCT20002") Then                '检查恢复数据库的权限
			  Response.Write("<Script>parent.frames['BottomFrame'].location.href='javascript:history.back();';</script>")
			  Response.End
		  End If
		Response.Write "<html>"
		Response.Write "<head>"
		Response.Write "<meta http-equiv=""Content-Type"" content=""text/html; charset=gb2312"">"
		Response.Write "<title>恢复数据库</title>"
		Response.Write "<link href=""../Inc/Admin_Style.CSS"" rel=""stylesheet"" type=""text/css"">"
		  Response.Write ("<body oncontextmenu=""return false;"" scroll=no>")
		  Response.Write "<table width=""100%"" border=""0"" cellspacing=""0"" cellpadding=""0"" class=""sortbutton"">"
		  Response.Write "  <tr>"
		  Response.Write "    <td height=""23"" align=""center""><strong>数据库恢复管理</strong>"
		  Response.Write "</td>"
		  Response.Write "</tr>"
		  Response.Write "</table>"
		Response.Write "<table width=""100%""  border=""0"" cellpadding=""0"" cellspacing=""0"">"
		Response.Write "  <tr> "
		Response.Write "    <td align=""center"" valign=""top""> <br> <strong><br>"
		Response.Write "      </strong> <table width=""560"" border=""0"" cellpadding=""2"" cellspacing=""1"">"
		Response.Write "        <tr> "
		Response.Write "          <td height=""25"" align=""center""> "
				
		if request("submit1")="恢复选中的备份文件" then
			if Request.Form("backname")="0" then
			  Response.Write ("<script>alert('没有备份文件!');history.back();</script>")
			  Response.End
			end if
		   if  RestoreDatabase(Request.Form("backname"),Request("Action"))=true then
			  if request("Action")="main" then
			 Response.Write "<div align=center><font color=green>操作成功!</font></div><div align=center>主数据库已从<font color=red>" & Request.Form("backname") & "</font>备份中恢复!</div>"
			  else
			 Response.Write "<div align=center><font color=green>操作成功!</font></div><div align=center>采集数据库已从<font color=red>" & Request.Form("backname") & "</font>备份中恢复!</div>"
			  end if
		   else
			 Response.Write "<font color=red>操作失败!</font>"
		   end if
		elseif request("submit1")="删除选中的备份文件" then
		   if Request.Form("backname")="0" then
			  Response.Write ("<script>alert('没有备份文件!');history.back();</script>")
			  Response.End
			end if
		  if  DeleteFile(Request.Form("backname"))=true then
			 Response.Write "<div align=center><font color=green>操作成功!</font></div><div align=center>备份文件<font color=red>" & Request.Form("backname") & "</font>已删除!</div>"
		   else
			 Response.Write "<font color=red>操作失败!</font>"
		   end if
		end if  
		
		
		Response.Write "</td>"
		Response.Write "        </tr>"
		Response.Write "        <tr> "
				 
		Response.Write "           <td>"
		
		if Application("DataBaseType")=0 then
		Response.Write "          <form method=""post"" name=""restoreform"" action=""db_restore.asp?Action=main"">"
		Response.Write "<br> <fieldset>"
		Response.Write "	<legend>主数据库已备份的文件</legend>"
					
					
		Response.Write "              <table width=""96%"" border=""0"" align=""center"" cellpadding=""0"" cellspacing=""2"">"
		Response.Write "                <tr> "
		Response.Write "                  <td height=""22"" align=""center""><strong>选择备份文件:</strong>"
		
							dim  tempStr,strCurDir,CurrDataBase,CurrLdb,Fso,Dir,s
							dim havebackfile:havebackfile=false
							tempStr=replace(dbpath,"/","\")
							tempStr=split(tempStr,"\")
							strCurDir=replace(dbpath,tempStr(ubound(tempStr)),"")
							strCurDir=server.mappath(strCurDir)
							
							 CurrDataBase=tempStr(ubound(tempStr))
							 CurrLdb=left(CurrDataBase,len(CurrDataBase)-4) & ".ldb"
							
		Response.Write "				    <select name=""backname"">"
							 
						  set fso = Server.CreateObject(KSCMS.GetConfig("FsoObjName"))
						  set dir = fso.GetFolder(strCurDir)
						  for each s in dir.Files
							 if s.name<>CurrDataBase and s.name<>Currldb then
							  havebackfile=true
							Response.Write "<option value=""" & strCurDir &"\" & s.name & """>" & s.name & "</option>"
							end if
						  next
						  if havebackfile=false then
						   Response.Write "<option value=""0"">---还没有备份的主数据库文件---</option>"
						   end if
		Response.Write "		            </select></td>"
		Response.Write "               </tr>"
		Response.Write "              </table>"
		Response.Write "			  </fieldset>"
		Response.Write "			  <table width=""100%"" border=""0"">"
		Response.Write "			   <tr><td height=""50"" align=center>"
		Response.Write "			     <input type=""submit"" name=""submit1"" "
		if havebackfile=false then Response.Write "disabled"
		Response.Write " value=""恢复选中的备份文件"" onclick=""return(confirm('确定恢复数据库吗?此操作不可逆'))"">"
		Response.Write "			     <input name=""submit1"" type=""submit"" "
		if havebackfile=false then Response.Write " disabled" 
		Response.Write " value=""删除选中的备份文件"" onclick=""return(confirm('确定删除选中的备份文件吗?此操作不可逆'))""/>"
		Response.Write "			   </td>"
		Response.Write "			   </tr>"
		Response.Write "		      </table>"
		Response.Write "          </form>"
		Response.Write "		    </td>"
		Response.Write "        </tr>"
		Response.Write "      </table>"
		Response.Write "     </td>"
		Response.Write "  </tr>"
		Response.Write "</table>"
		
		end if
		Response.Write "             <br><table width=""560"" border=""0"" align=""center"" cellpadding=""0"" cellspacing=""2"">"
		Response.Write "                <tr> "
		
		Response.Write "          <form method=""post"" name=""restoreform"" action=""db_restore.asp?Action=collect"">"
				 
		Response.Write "          <td><fieldset>"
		Response.Write "	<legend>采集数据库已备份的文件</legend>"
					
					
		Response.Write "              <table width=""96%"" border=""0"" align=""center"" cellpadding=""0"" cellspacing=""2"">"
		Response.Write "                <tr> "
		Response.Write "                  <td height=""22"" align=""center""><strong>选择备份文件:</strong>"
		
							
							havebackfile=false
							tempStr=replace(CollectDBPath,"/","\")
							tempStr=split(tempStr,"\")
							strCurDir=replace(CollectDBPath,tempStr(ubound(tempStr)),"")
							strCurDir=server.mappath(strCurDir)
							
							 CurrDataBase=tempStr(ubound(tempStr))
							 CurrLdb=left(CurrDataBase,len(CurrDataBase)-4) & ".ldb"
							
		Response.Write "				    <select name=""backname"">"
							 
						  set fso = Server.CreateObject(KSCMS.GetConfig("FsoObjName"))
						  set dir = fso.GetFolder(strCurDir)
						  for each s in dir.Files
							 if s.name<>CurrDataBase and s.name<>Currldb then
							  havebackfile=true
							Response.Write "<option value=""" & strCurDir &"\" & s.name & """>" & s.name & "</option>"
							end if
						  next
						  if havebackfile=false then
						   Response.Write "<option value=""0"">---还没有备份的采集数据库文件---</option>"
						   end if
		Response.Write "		            </select></td>"
		Response.Write "               </tr>"
		Response.Write "              </table>"
		Response.Write "			  </fieldset>"
		
		Response.Write "			  <table width=""100%"" border=""0"">"
		Response.Write "			   <tr><td height=""50"" align=center>"
		Response.Write "			     <input type=""submit"" name=""submit1"" "
		if havebackfile=false then Response.Write "disabled"
		Response.Write " value=""恢复选中的备份文件"" onclick=""return(confirm('确定恢复数据库吗?此操作不可逆'))"">"
		Response.Write "			     <input name=""submit1"" type=""submit"" "
		if havebackfile=false then Response.Write " disabled" 
		Response.Write " value=""删除选中的备份文件"" onclick=""return(confirm('确定删除选中的备份文件吗?此操作不可逆'))""/>"
		Response.Write "			   </td>"
		Response.Write "			   </tr>"
		Response.Write "		      </table>"
		
		Response.Write "          </form>"
		Response.Write "			   </td>"
		Response.Write "			   </tr>"
		Response.Write "		      </table>"
		
		
		
		Response.Write "</body>"
		Response.Write "</html>"
		End Sub
		
		' 恢复数据库
		Public Function RestoreDatabase(BackName,Action)
				dim fso,sFileName
				RestoreDatabase=false
				on error resume next
				set fso = Server.CreateObject(KSCMS.GetConfig("FsoObjName"))
				IF Action="main" Then  '主数据库
				  sFileName = DbPath
				  Conn.Close
				  fso.CopyFile BackName, server.mappath(DbPath), True
				  if err then
					RestoreDatabase=false
				  else
					RestoreDatabase=true
				  end if
				  conn.Open Application("ConnStr")
				Elseif Action="collect" Then  '采集数据库
				 
				 sFileName = CollectDBPath
				  fso.CopyFile BackName, server.mappath(CollectDBPath), True
				  if err then
					RestoreDatabase=false
				  else
					RestoreDatabase=true
				  end if
				Else 
				  RestoreDatabase=false
				  Exit Function
				End IF
			   IF err Then
				RestoreDatabase=false
			   End IF
			End Function
		
		'**************************************************
		'函数名:DeleteFile
		'作  用:删除指定文件
		'参  数:FileStr要删除的文件
		'返回值:成功返回true 否则返回Flase
		'**************************************************
		Function DeleteFile(FileStr)
		   Dim fso
		   On Error Resume Next
		   Set fso = CreateObject(KSCMS.GetConfig("FsoObjName"))
			If fso.FileExists(FileStr) Then
				fso.DeleteFile FileStr, True
			Else
			DeleteFile = True
			End If
		   Set fso = Nothing
		   If Err.Number <> 0 Then
		   Err.Clear
		   DeleteFile = False
		   Else
		   DeleteFile = True
		   End If
		End Function
End Class
%>

⌨️ 快捷键说明

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