还是没人?扔块砖头,这是VBS的---
<%
dim action
dim admin_flag
action=trim(request("action"))
dim dbpath,bkfolder,bkdbname,fso,fso1
select case action
case "CompressData" '压缩数据
admin_flag="61"
if not master or instr(session("flag"),admin_flag)=0 then
Errmsg=Errmsg+"<br>"+"<li>本页面为管理员专用,请<a href=admin_index.asp target=_top>登陆</a>后进入。<br><li>您没有管理本页面的权限。"
call dvbbs_error()
else
dim tmprs
dim allarticle
dim Maxid
dim topic,username,dateandtime,body
call CompressData()
end if case "BackupData" '备份数据
admin_flag="62"
if not master or instr(session("flag"),admin_flag)=0 then
Errmsg=Errmsg+"<br>"+"<li>本页面为管理员专用,请<a href=admin_index.asp target=_top>登陆</a>后进入。<br><li>您没有管理本页面的权限。"
call dvbbs_error()
else
if request("act")="Backup" then
call updata()
else
call BackupData()
end if
end ifcase "RestoreData" '恢复数据
admin_flag="63"
dim backpath
if not master or instr(session("flag"),admin_flag)=0 then
Errmsg=Errmsg+"<br>"+"<li>本页面为管理员专用,请<a href=admin_index.asp target=_top>登陆</a>后进入。<br><li>您没有管理本页面的权限。"
call dvbbs_error()
else
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
end if case "SpaceSize" '系统空间占用
admin_flag="64"
if not master or instr(session("flag"),admin_flag)=0 then
Errmsg=Errmsg+"<br>"+"<li>本页面为管理员专用,请<a href=admin_index.asp target=_top>登陆</a>后进入。<br><li>您没有管理本页面的权限。"
call dvbbs_error()
else
call SpaceSize()
end ifcase else
Errmsg=Errmsg+"<br>"+"<li>选取相应的操作。"
call dvbbs_error()end selectconn.close
set conn=nothing
response.write"</body></html>"
<%
dim action
dim admin_flag
action=trim(request("action"))
dim dbpath,bkfolder,bkdbname,fso,fso1
select case action
case "CompressData" '压缩数据
admin_flag="61"
if not master or instr(session("flag"),admin_flag)=0 then
Errmsg=Errmsg+"<br>"+"<li>本页面为管理员专用,请<a href=admin_index.asp target=_top>登陆</a>后进入。<br><li>您没有管理本页面的权限。"
call dvbbs_error()
else
dim tmprs
dim allarticle
dim Maxid
dim topic,username,dateandtime,body
call CompressData()
end if case "BackupData" '备份数据
admin_flag="62"
if not master or instr(session("flag"),admin_flag)=0 then
Errmsg=Errmsg+"<br>"+"<li>本页面为管理员专用,请<a href=admin_index.asp target=_top>登陆</a>后进入。<br><li>您没有管理本页面的权限。"
call dvbbs_error()
else
if request("act")="Backup" then
call updata()
else
call BackupData()
end if
end ifcase "RestoreData" '恢复数据
admin_flag="63"
dim backpath
if not master or instr(session("flag"),admin_flag)=0 then
Errmsg=Errmsg+"<br>"+"<li>本页面为管理员专用,请<a href=admin_index.asp target=_top>登陆</a>后进入。<br><li>您没有管理本页面的权限。"
call dvbbs_error()
else
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
end if case "SpaceSize" '系统空间占用
admin_flag="64"
if not master or instr(session("flag"),admin_flag)=0 then
Errmsg=Errmsg+"<br>"+"<li>本页面为管理员专用,请<a href=admin_index.asp target=_top>登陆</a>后进入。<br><li>您没有管理本页面的权限。"
call dvbbs_error()
else
call SpaceSize()
end ifcase else
Errmsg=Errmsg+"<br>"+"<li>选取相应的操作。"
call dvbbs_error()end selectconn.close
set conn=nothing
response.write"</body></html>"
sub SpaceSize()
on error resume next
%>
<table border="0" cellspacing="1" cellpadding="5" height="1" align=center width="95%" class="tableBorder"> <tr>
<th height=25>
系统空间占用情况
</th>
</tr>
<tr>
<td class="forumrow">
<blockquote>
<br>
法规数据占用空间: <img src="pic/bar1.gif" width=<%=drawbar("data")%> height=10> <%showSpaceinfo("data")%><br><br>
备份数据占用空间: <img src="pic/bar1.gif" width=<%=drawbar("databackup")%> height=10> <%showSpaceinfo("databackup")%><br><br>
程序文件占用空间: <img src="pic/bar1.gif" width=<%=drawspecialbar%> height=10> <%showSpecialSpaceinfo("Program")%><br><br>
心情图片占用空间: <img src="pic/bar1.gif" width=<%=drawbar("images")%> height=10> <%showSpaceinfo("face")%><br><br>
系统图片占用空间: <img src="pic/bar1.gif" width=<%=drawbar("pic")%> height=10> <%showSpaceinfo("pic")%><br><br>
上传头像占用空间: <img src="pic/bar1.gif" width=<%=drawbar("uploadFace")%> height=10> <%showSpaceinfo("uploadFace")%><br><br>
上传图片占用空间: <img src="pic/bar1.gif" width=<%=drawbar("uploadImages")%> height=10> <%showSpaceinfo("uploadImages")%><br><br>
系统占用空间总计:<br><img src="pic/bar1.gif" width=400 height=10> <%showspecialspaceinfo("All")%>
</blockquote>
</td>
</tr>
</table>
<%
end sub'====================恢复数据库=========================
sub RestoreData()
%>
<table border="0" cellspacing="1" cellpadding="5" height="1" align=center width="95%" class="tableBorder" <tr>
<th height=25 >
<B>恢复论坛数据</B>( 需要FSO支持,FSO相关帮助请看微软网站 )
</th>
</tr>
<form method="post" action="ADMIN_data.asp?action=RestoreData&act=Restore">
<tr>
<td height=100 class="forumrow">
备份数据库路径(相对):<input type=text size=30 name=DBpath value="DataBackup\dvbbs6_Backup.MDB"> <BR>
目标数据库路径(相对):<input type=text size=30 name=backpath value="<%=db%>"><BR> 填写您当前使用的数据库路径,如不想覆盖当前文件,可自行命名(注意路径是否正确),然后修改conn.asp文件,如果目标文件名和当前使用数据库名一致的话,不需修改conn.asp文件<BR>
<input type=submit value="恢复数据"> <br>
-----------------------------------------------------------------------------------------<br>
在上面填写本程序的数据库路径全名,本程序的默认备份数据库文件为DataBackup\dvbbs_Backup.MDB,请按照您的备份文件自行修改。<br>
您可以用这个功能来备份您的法规数据,以保证您的数据安全!<br>
注意:所有路径都是相对与程序空间根目录的相对路径</font>
</td>
</tr>
</form>
</table>
<%
end sub'====================备份数据库=========================
sub BackupData()
%>
<table border="0" cellspacing="1" cellpadding="5" height="1" align=center width="95%" class="tableBorder">
<tr>
<th height=25 >
<B>备份论坛数据</B>( 需要FSO支持,FSO相关帮助请看微软网站 )
</th>
</tr>
<form method="post" action="ADMIN_data.asp?action=BackupData&act=Backup">
<tr>
<td height=100 class="forumrow">
当前数据库路径(相对路径):<input type=text size=15 name=DBpath value="<%=db%>"><BR>
备份数据库目录(相对路径):<input type=text size=15 name=bkfolder value=Databackup> 如目录不存在,程序将自动创建<BR>
备份数据库名称(填写名称):<input type=text size=15 name=bkDBname value=dvbbs6.MDB> 如备份目录有该文件,将覆盖,如没有,将自动创建<BR>
<input type=submit value="确定"><br>
-----------------------------------------------------------------------------------------<br>
在上面填写本程序的数据库路径全名,本程序的默认数据库文件为Data\dvbbs6.MDB,<B>请一定不能用默认名称命名备份数据库</B><br>
您可以用这个功能来备份您的法规数据,以保证您的数据安全!<br>
注意:所有路径都是相对与程序空间根目录的相对路径 </font>
</td>
</tr>
</form>
</table>
<%
end subsub 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 "备份数据库成功,您备份的数据库路径为" &bkfolder& "\"& bkdbname
Else
response.write "找不到您所需要备份的文件。"
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