backdata.asp
上传用户:btntkt
上传日期:2021-04-16
资源大小:5296k
文件大小:3k
源码类别:

WEB源码(ASP,PHP,...)

开发平台:

DOS

  1. <!--#include file="conn.asp"-->
  2. <%
  3. dim cls
  4. if session("admin")="" then
  5. Response.Redirect("admin.asp")
  6. else
  7. if session("flag")<>"0" then
  8. cls = Instr(session("flag"), "datafig")
  9. if cls <= 0 then
  10. %>
  11. <script language="javascript">
  12. if (confirm("您的操作权限不够,系统拒绝你的访问,请点确定返回,或者点取消退出重新登录"))
  13.   location.href="login.asp";
  14. else
  15.   location.href="index.asp";
  16. </script>
  17. <%
  18. end if
  19. end if
  20. end if
  21. %>
  22. <html>
  23. <head>
  24. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  25. <link href="../images/css.css" rel="stylesheet" type="text/css">
  26. </head>
  27. <body>
  28. <%
  29. dim bkfolder
  30. dim bkdbname
  31. dim fso
  32. dim folderpath,fso1,f
  33. call main()
  34. conn.close
  35. set conn=nothing
  36. sub main()
  37. %>
  38. <%
  39. if request("action")="Backup" then
  40. call backupdata()
  41. else
  42. %>
  43. <table class="tableBorder" width="90%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
  44. <tr> 
  45. <td align="center" background="../images/admin_bg_1.gif"><b><font color="#ffffff">备份数据库</font></b></td>
  46. </tr>
  47. <tr>
  48. <td width="100%" >
  49. <font color="#FF0000">注意:备份数据需要FSO组件支持,FSO组件的相关帮助!路径都是程序空间根目录的相对路径!可能在有些空间备份后,在本机上不能用ACCESS打开,此功能小心使用。</font></td>
  50. </tr>
  51. <tr><form method="post" action="Backdata.asp?action=Backup">
  52. <td width="100%" >
  53. 当前数据库路径:
  54.         <input type=text size=24 name=DBpath value="../bbs/data/tretge@!#$@!$321wygkcn!@$#@!$.mdb"> 
  55. 请正确添写您当前使用的数据库路径!<BR>
  56. 备份数据库目录:<input type=text size=24 name=bkfolder value=../Databackup>
  57. 如果目录不存在,程序将自动创建!<BR>
  58.         备份数据库名称:默认为shop.mdb 备份后请到相应目录下下载数据备份! <br>
  59. <input type=submit value="开始备份"></td>
  60. <tr>
  61. <td width="100%" >
  62. 在上面填写数据库路径及数据库完整名称,程序的默认数据库文件为shop.mdb<br>
  63. 您可以用这个功能来备份您的数据库,以保证数据的安全!<br></td>
  64. </tr></form>
  65. </table>
  66. <%
  67. end if
  68. %>
  69. <%
  70. end sub
  71. sub backupdata()
  72. Dbpath=request.form("Dbpath")
  73. Dbpath=server.mappath(Dbpath)
  74. bkfolder=request.form("bkfolder")
  75. bkdbname="shop.mdb"
  76. Set Fso=server.createobject("scripting.filesystemobject")
  77. if fso.fileexists(dbpath) then
  78. If CheckDir(bkfolder) = True Then
  79. fso.copyfile dbpath,bkfolder& ""& bkdbname
  80. else
  81. MakeNewsDir bkfolder
  82. fso.copyfile dbpath,bkfolder& ""& bkdbname
  83. end if
  84. response.write "数据库备份完成,请进行其他操作!<br>建议使用 FTP 工具将数据库备份,以保证数据安全"
  85. else
  86. response.write "找不到您所需要备份的文件!"
  87. end if
  88. end sub
  89. Function CheckDir(FolderPath)
  90. folderpath=Server.MapPath(".")&""&folderpath
  91. Set fso1 = CreateObject("Scripting.FileSystemObject")
  92. If fso1.FolderExists(FolderPath) then
  93. CheckDir = True
  94. Else
  95. CheckDir = False
  96. End if
  97. Set fso1 = nothing
  98. End Function
  99. Function MakeNewsDir(foldername)
  100. Set fso1 = CreateObject("Scripting.FileSystemObject")
  101. Set f = fso1.CreateFolder(foldername)
  102. MakeNewsDir = True
  103. Set fso1 = nothing
  104. End Function
  105. %>
  106. <!--#include file="foot.asp"-->
  107. </body>
  108. </html>