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

📄 data_manage.asp

📁 鄂尔多斯建站网全站程序(冬季修正版)
💻 ASP
字号:
<!--#include file="conn.asp"-->
<!--#include file="session.asp"-->
<!--#include file="../include/code.asp"-->
<%
'**********************************
'版本:host_free 3.0               *
'官方网站:http://www.850518.com   *
'技术论坛:http://forum.850518.com *
'qq:54455245 (欢迎咨询商业版)     *
'msn: steven_bass@msn.com         *
'手机:(0)13632779827              *
'mail:wtez@vip.163.com            *
'版权所有,请保留该信息,谢谢合作 *
'**********************************
%>
<html>

<head>
<meta http-equiv="content-language" content="zh-cn">
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<meta name="generator" content="microsoft frontpage 6.0">
<meta name="progid" content="frontpage.editor.document">
<link href="style.css" rel=stylesheet>
</head>

<body style="background-color: #eeeeee">
<%
if request("bass")="backupdata" then
call updata()
elseif request("bass")="compressdata" then
call compactdb()
elseif request("bass")="restoredata" then
call restore()
end if
'=================================================================备份数据库
sub updata()
	    dbpath=server.mappath(request.form("dbpath"))
		bkfolder=request.form("bkfolder")
		bkdbname=request.form("bkdbname")
		if bkfolder="" then
		response.write "<script>alert('备份数据库目录为空');history.go(-1)</script>"
		response.end
		end if
		if bkdbname="" then
		response.write "<script>alert('备份数据库名称为空');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
			end if
			response.write "<script>alert('备份数据库成功');history.go(-1)</script>"
		else
			response.write "<script>alert('找不到您所需要备份的数据库文件');history.go(-1)</script>"
		end if
end sub
'=================================================================压缩数据库
function compactdb()
	dim engine, strdbpath
	dbpath=server.mappath(request.form("dbpath"))
	strdbpath = left(dbpath,instrrev(dbpath,"\"))
	set fso = server.createobject("scripting.filesystemobject")
	if fso.fileexists(dbpath) then
		set engine = createobject("jro.jetengine")
		engine.compactdatabase "provider=microsoft.jet.oledb.4.0;data source=" & dbpath," provider=microsoft.jet.oledb.4.0;data source=" & strdbpath & "temp.mdb"
		fso.copyfile strdbpath & "temp.mdb",dbpath
		fso.deletefile(strdbpath & "temp.mdb")
		set fso = nothing
		set engine = nothing
		response.write "<script>alert('压缩数据库成功');history.go(-1)</script>"
	else
		response.write "<script>alert('数据库没有找到');history.go(-1)</script>"
	end if
end function
'=================================================================恢复数据库
sub restore()
			dbpath=request.form("dbpath")
			backpath=request.form("backpath")
			if dbpath="" then
			response.write "请输入备份数据库的路径和全名<br><br>"
			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 "<script>alert('数据库已经恢复');history.go(-1)</script>"
			else
			response.write "<<script>alert('找不到您所需要备份的数据库文件');history.go(-1)</script>"	
			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)
	dim f
    set fso1 = createobject("scripting.filesystemobject")
        set f = fso1.createfolder(foldername)
        makenewsdir = true
    set fso1 = nothing
end function
'=================================================================
%>
<div align="center">
  <center>
  <table border="0" cellpadding="0" cellspacing="1" width="600" bgcolor="#626262">
    <tr>
      <td height="20">&nbsp; <b><font color="#ffffff">数据库操作</font></b></td>      
    </tr>
    <tr>
      <td height="500" bgcolor="#ffffff">
        <table border="0" cellpadding="0" cellspacing="1" width="100%">
        <%if request("action")="backupdata" then%>
          <tr>
            <td width="100%">
              <table border="0" cellpadding="0" cellspacing="0" width="100%">
              <form method="post" action="?bass=backupdata">
                <tr>
                  <td width="31%" height="25" align="right">当前数据库地址(相对路径):</td>
                  <td width="69%" height="25">&nbsp;<input type="text" name="dbpath" size="45" value="<%=db%>"></td>
                </tr>
                <tr>
                  <td width="31%" height="25" align="right">备份数据库目录(相对路径):</td>
                  <td width="69%" height="25">&nbsp;<input type="text" name="bkfolder" size="30" value="../databackup"> 
                    目录不存在,程序自动创建</td>   
                </tr>
                <tr>
                  <td width="31%" height="25" align="right">备份数据库名称(文件全名):</td>
                  <td width="69%" height="25">&nbsp;<input type="text" name="bkdbname" size="30" value="<%=date()%>.asp"> 
                    有此文件将覆盖,没有则将自动创建</td>  
                </tr>
                <tr>
                  <td width="100%" colspan="2" height="30">
                    <p align="center"><input type="submit" value=" 开始备份 " name="b3"></td>
                </tr>
                </form>
              </table>
            </td>
          </tr>
          <%end if
          if request("action")="compressdata" then%>
  </center>
          <tr>
            <td width="100%">
              <table border="0" cellpadding="0" cellspacing="0" width="100%">
              <form method="post" action="?bass=compressdata">
                <tr>
                  <td width="37%" height="25">
                    <p align="right">压缩数据库地址(相对路径):</td>
                  <td width="62%" height="25">&nbsp;<input type="text" name="dbpath" size="45" value="../databackup/<%=date()%>.asp"></td>
                </tr>
                <tr>
                  <td width="99%" height="25" colspan="2">
                    <p align="center">正在使用中的数据库不能压缩,请选择备份数据库进行压缩操作</td>
                </tr>
  <center>
  <tr>
    <td width="100%" colspan="2" height="30">
      <p align="center"><input type="submit" value=" 开始压缩 " name="b3"></td>
  </tr></form>
                </table>
              </center>
              </td>
          </tr>
          <%end if
          if request("action")="restoredata" then%>
          <tr>
            <td width="100%">
              <table border="0" cellpadding="0" cellspacing="0" width="100%">
              <form method="post" action="?bass=restoredata">
                <tr>
                  <td width="38%" height="25" align="right">备份数据库路径(相对):</td>
                  <td width="62%" height="25">&nbsp;<input type=text size=40 name=dbpath value="../databackup/<%=date()%>.asp"></td>
                </tr>
                <tr>
                  <td width="38%" height="25" align="right">目标数据库路径(相对):</td>
                  <td width="62%" height="25">&nbsp;<input type=text size=40 name="backpath" value="<%=db%>">

                  </td>
                </tr>
                <tr>
                  <td width="100%" colspan="2" height="30">
                    <p align="center"><input type="submit" value=" 恢复数据 " name="b3"></td>
                </tr>
                </form>
              </table>
            </td>
          </tr>
          <%end if%>
        </table>
      </td>
    </tr>
  </table>
</div>

</body>

</html>
<%conn.close
set conn=nothing%>
<%
'**********************************
'版本:host_free 3.0               *
'官方网站:http://www.850518.com   *
'技术论坛:http://forum.850518.com *
'qq:54455245 (欢迎咨询商业版)     *
'msn: steven_bass@msn.com         *
'手机:(0)13632779827              *
'mail:wtez@vip.163.com            *
'版权所有,请保留该信息,谢谢合作 *
'**********************************
%>

⌨️ 快捷键说明

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