📄 b2b_sysdata.asp
字号:
<!--#include file =conn.asp-->
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<%
if session("admin")="" then
conn.close
set conn = nothing
response.Write "<script language='javascript'>alert('请先登录!');history.go(-1);</script>"
response.End
else
if request.cookies("Buy2Buy")("admin")="" then
conn.close
set conn = nothing
response.Write "<script language='javascript'>alert('请先登录!');history.go(-1);</script>"
response.End
end if
end if
'所有无权限
if session("rank")>1 then
conn.close
set conn = nothing
response.Write "<script language='javascript'>alert('您的管理权限未达到此操作等级!');history.go(-1);</script>"
response.End
end if
%>
<style type="text/css">
<!--
-->
</style>
<link href="admincss.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.STYLE1 {color: #000000;
font-weight: bold;
}
.style4 {color: #FF0000}
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
-->
</style>
<table width="99%" border="5" align="center" cellpadding="5" cellspacing="5" bordercolor="#CCCCCC" bgcolor="#FFFFFF">
<tr>
<td background="images/topbg.gif"><span class="STYLE1"><img src="images/pic5.gif" width="28" height="22" align="absmiddle" />您现在所在的位置是: <a href="adminhelp.asp">管理首页</a> -> <span class="style4">系统数据维护</span></span></td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF">
<%
dim action
action=trim(request("action"))
dim dbpath,bkfolder,bkdbname,fso,fso1
select case action
case "CompressData" '压缩数据
call CompressData()
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 "成功恢复数据!"
else
response.write "备份目录下并无您的备份文件!"
end if
else
call RestoreData()
end if
case else
Errmsg=ErrMsg + "<BR><li>选取相应的操作。"
end select
response.write"</body></html>"
sub SQLReadme()
%>
<%
end sub
'====================恢复数据库=========================
sub RestoreData()
If IsSqlDataBase = 1 Then
SQLReadme()
Exit Sub
End If
%>
<br>
<table width="95%" border="2" align=center cellpadding="1" cellspacing="1" bordercolor="#FFFFFF" bgcolor="#CCCCCC">
<tr>
<td height=25 align="center" background="images/topbg.gif" bgcolor="#F7F7F7"><B>恢复商城数据</B></td>
</tr>
<tr>
<form method="post" action="b2b_sysdata.asp?action=RestoreData&act=Restore">
<td height=100 bgcolor="#FFFFFF" class="forumrow">
备份数据库路径(相对):<input name=DBpath type=text class="input_sr" value="" size=40>
<BR>
目标数据库路径(相对):<input name=backpath type=text class="input_sr" value="正确填写您当前使用的数据库路径" size=35>
<BR> <BR>
<input type=submit class="input_bot" value="恢复数据">
</td></form>
</tr>
</table>
<br>
<%
end sub
'====================备份数据库=========================
sub BackupData()
If IsSqlDataBase = 1 Then
SQLReadme()
Exit Sub
End If
%>
<br>
<table width="95%" border="2" align=center cellpadding="1" cellspacing="1" bordercolor="#FFFFFF" bgcolor="#CCCCCC">
<tr>
<td height=25 align="center" background="images/topbg.gif" bgcolor="#F7F7F7"><font color="#000000"><B>备份商城数据</B></font></td>
</tr>
<form method="post" action="b2b_sysdata.asp?action=BackupData&act=Backup">
<tr>
<td bgcolor="#FFFFFF">
当前数据库路径(相对路径):<input name=DBpath type=text class="input_sr" size=35>
<BR>
<BR>
备份数据库名称(填写名称):<input name=bkDBname type=text class="input_sr" value=请正确填写您当前使用的数据库别及后缀 size=35>
如备份目录有该文件,将覆盖,如没有,将自动创建<br>
<BR>
<input type=submit class="input_bot" value="确定">
<br>
</td>
</tr>
</form>
</table>
<br>
<%
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 "<script>alert('数据库备份成功!');</script>"
Else
response.write "<script>alert('源数据库路径错误或不存在!');</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
'====================压缩数据库 =========================
sub CompressData()
If IsSqlDataBase = 1 Then
SQLReadme()
Exit Sub
End If
%>
<br>
<table width="95%" border="2" cellpadding="1" cellspacing="1" bordercolor="#FFFFFF" bgcolor="#CCCCCC" halign=center>
<tr>
<td height=25 align="center" background="images/topbg.gif" bgcolor="#F7F7F7" class="forumrow"><strong>压缩商城数据</strong></td>
</tr>
<tr>
<td bgcolor="#FFFFFF" class="forumrow">压缩数据库:<input name="dbpath" type="text" class="input_sr" value=请正确填写您当前使用的数据库名及后缀 size="35">
<input type="submit" class="input_bot" value="开始压缩"></td>
</tr>
<tr>
<td bgcolor="#FFFFFF" class="forumrow"><input type="checkbox" name="boolIs97" value="True">如果使用 Access 97 数据库请选择
(默认为 Access 2000 数据库)</td>
</tr>
<tr>
<td bgcolor="#FFFFFF" class="forumrow style4">输入数据库所在相对路径,并且输入数据库名称(正在使用中数据库不能压缩,请选择备份数据库进行压缩操作)</td>
</tr>
</table>
<br>
<%
dim dbpath,boolIs97
dbpath = request("dbpath")
boolIs97 = request("boolIs97")
If dbpath <> "" Then
dbpath = server.mappath(dbpath)
response.write(CompactDB(dbpath,boolIs97))
End If
end sub
'=====================压缩参数=========================
Function CompactDB(dbPath, boolIs97)
Dim fso, Engine, strDBPath,JET_3X
strDBPath = left(dbPath,instrrev(DBPath,"\"))
Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FileExists(dbPath) Then
fso.CopyFile dbpath,strDBPath & "temp.mdb"
Set Engine = CreateObject("JRO.JetEngine")
If boolIs97 = "True" Then
Engine.CompactDatabase "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & "temp.mdb", _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & "temp1.mdb;" _
& "Jet OLEDB:Engine Type=" & JET_3X
Else
Engine.CompactDatabase "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & "temp.mdb", _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & "temp1.mdb"
End If
fso.CopyFile strDBPath & "temp1.mdb",dbpath
fso.DeleteFile(strDBPath & "temp.mdb")
fso.DeleteFile(strDBPath & "temp1.mdb")
Set fso = nothing
Set Engine = nothing
CompactDB = "你的数据库, " & dbpath & ", 已经压缩成功!" & vbCrLf
Else
CompactDB = "数据库名称或路径不正确. 请重试!" & vbCrLf
End If
End Function
'=====================系统空间参数=========================
Sub ShowSpaceInfo(drvpath)
dim fso,d,size,showsize
set fso=server.createobject("scripting.filesystemobject")
drvpath=server.mappath(drvpath)
set d=fso.getfolder(drvpath)
size=d.size
showsize=size & " Byte"
if size>1024 then
size=(Size/1024)
showsize=size & " KB"
end if
if size>1024 then
size=(size/1024)
showsize=formatnumber(size,2) & " MB"
end if
if size>1024 then
size=(size/1024)
showsize=formatnumber(size,2) & " GB"
end if
response.write "<font face=verdana>" & showsize & "</font>"
End Sub
Sub Showspecialspaceinfo(method)
dim fso,d,fc,f1,size,showsize,drvpath
set fso=server.createobject("scripting.filesystemobject")
drvpath=server.mappath("pic")
drvpath=left(drvpath,(instrrev(drvpath,"\")-1))
set d=fso.getfolder(drvpath)
if method="All" then
size=d.size
elseif method="Program" then
set fc=d.Files
for each f1 in fc
size=size+f1.size
next
end if
showsize=size & " Byte"
if size>1024 then
size=(Size/1024)
showsize=size & " KB"
end if
if size>1024 then
size=(size/1024)
showsize=formatnumber(size,2) & " MB"
end if
if size>1024 then
size=(size/1024)
showsize=formatnumber(size,2) & " GB"
end if
response.write "<font face=verdana>" & showsize & "</font>"
end sub
Function Drawbar(drvpath)
dim fso,drvpathroot,d,size,totalsize,barsize
set fso=server.createobject("scripting.filesystemobject")
drvpathroot=server.mappath("pic")
drvpathroot=left(drvpathroot,(instrrev(drvpathroot,"\")-1))
set d=fso.getfolder(drvpathroot)
totalsize=d.size
drvpath=server.mappath(drvpath)
set d=fso.getfolder(drvpath)
size=d.size
barsize=cint((size/totalsize)*400)
Drawbar=barsize
End Function
Function Drawspecialbar()
dim fso,drvpathroot,d,fc,f1,size,totalsize,barsize
set fso=server.createobject("scripting.filesystemobject")
drvpathroot=server.mappath("pic")
drvpathroot=left(drvpathroot,(instrrev(drvpathroot,"\")-1))
set d=fso.getfolder(drvpathroot)
totalsize=d.size
set fc=d.files
for each f1 in fc
size=size+f1.size
next
barsize=cint((size/totalsize)*400)
Drawspecialbar=barsize
End Function
%>
</td>
</tr>
</table>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -