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

📄 admin_data.asp

📁 AspEase Auction System Ver2.0/动易拍卖系统 Ver2.0
💻 ASP
字号:
<!--#include file ="conn.asp"-->
<!-- #include file="inc/info.asp" -->
<!-- #include file="inc/const.asp" -->
<%admheader
'=========================================================
'Copyright (C) 2003-2004 AspEase.Com. All rights reserved.
'Web: http://www.aspease.com
'Email: byhucn@126.com,lzz9812@163.com
'=========================================================
'
'FileName: admin_data.asp
'Version:2.0
'UpdateTime: 2004-10-7 15:11:27
'Script Written by www.aspease.com 
'=========================================================
action=request("action")
dim dbpath,bkfolder,bkdbname,fso,fso1,backpath
select case action
case "CompressData"		'压缩数据	
	call CompressData()
case "BackupData"		'备份数据
		if request("act")="Backup" then
		call updata()
		else
		call BackupData()
		end if
case "RestoreData"		'恢复数据
	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 "SpaceSize"		'系统空间占用
		call SpaceSize()
case else
		Errmsg=Errmsg+"<br>"+"<li>选取相应的操作。"
		Response.Write(Errmsg)
end select
admfooter

'====================系统空间占用=======================
sub SpaceSize()
on error resume next
response.Write("		<table border=""0""  cellspacing=""1"" cellpadding=""5"" height=""1"" align=center width=""95%"" class=""tableBorder"">			<tr>")
response.Write("  					<th height=25>")
response.Write("  					&nbsp;&nbsp;系统空间占用情况")
response.Write("  					</th>")
response.Write("  				</tr> 	")
response.Write(" 				<tr>")
response.Write(" 					<td class=""row""> 			")
response.Write(" 			<blockquote>")
response.Write(" 			<br>")
response.Write("        法规数据占用空间:&nbsp;<img src=""images/bar1.gif"" width=")
response.Write(drawbar("data"))
response.Write(" height=10>&nbsp;")
showSpaceinfo("data")
response.Write("<br>")
response.Write("        <br>")
response.Write(" 			备份数据占用空间:&nbsp;<img src=""images/bar1.gif"" width=")
response.Write(drawbar("databackup"))
response.Write(" height=10>&nbsp;")
showSpaceinfo("databackup")
response.Write("<br><br>")
response.Write(" 			程序文件占用空间:&nbsp;<img src=""images/bar1.gif"" width=")
response.Write(drawspecialbar)
response.Write(" height=10>&nbsp;")
showSpecialSpaceinfo("Program")
response.Write("<br><br>")
response.Write("			J S 文件占用空间:&nbsp;<img src=""images/bar1.gif"" width=")
response.Write(drawbar("js"))
response.Write(" height=10>&nbsp;")
showSpaceinfo("js")
response.Write("<br><br>")
response.Write("			INC 文件占用空间:&nbsp;<img src=""images/bar1.gif"" width=")
response.Write(drawbar("inc"))
response.Write(" height=10>&nbsp;")
showSpaceinfo("inc")
response.Write("<br><br>")
response.Write(" 			系统图片占用空间:&nbsp;<img src=""images/bar1.gif"" width=")
response.Write(drawbar("images"))
response.Write(" height=10>&nbsp;")
showSpaceinfo("images")
response.Write("<br><br>")
response.Write(" 			商品图片占用空间:&nbsp;<img src=""images/bar1.gif"" width=")
response.Write(drawbar("upload"))
response.Write(" height=10>&nbsp;")
showSpaceinfo("upload")
response.Write("<br><br>")
response.Write(" 			商店图片占用空间:&nbsp;<img src=""images/bar1.gif"" width=")
response.Write(drawbar("shopimg"))
response.Write(" height=10>&nbsp;")
showSpaceinfo("ShopImg")
response.Write("<br><br>	")
response.Write(" 			系统占用空间总计:<br><img src=""images/bar1.gif"" width=400 height=10> ")
showspecialspaceinfo("All")
response.Write(" 			</blockquote> 	")
response.Write(" 					</td>")
response.Write(" 				</tr>")
response.Write(" 			</table>")
end sub

'====================恢复数据库=========================
sub RestoreData()
response.Write("<table border=""0""  cellspacing=""1"" cellpadding=""5"" height=""1"" align=center width=""95%"" class=""tableBorder"">		<tr>")
response.Write("	<th height=25 > &nbsp;&nbsp;<B>恢复拍卖数据</B>( 需要FSO支持 ) </th>")
response.Write("  				</tr>")
response.Write("				<form method=""post"" action=""ADMIN_data.asp?action=RestoreData&act=Restore"">  				")
response.Write("  				<tr>")
response.Write("  					<td height=100 class=""row"">")
response.Write("  						&nbsp;&nbsp;备份数据库路径(相对):<input type=text size=30 name=DBpath value=""DataBackup\AspEaseAuction_Backup.MDB"">&nbsp;&nbsp;<BR>")
response.Write("  						&nbsp;&nbsp;目标数据库路径(相对):<input type=text size=30 name=backpath value=""")
response.Write(db)
response.Write("""><BR>&nbsp;&nbsp;填写您当前使用的数据库路径,如不想覆盖当前文件,可自行命名(注意路径是否正确),然后修改conn.asp文件,如果目标文件名和当前使用数据库名一致的话,不需修改conn.asp文件<BR>")
response.Write("						&nbsp;&nbsp;<input type=submit value=""恢复数据""> <br>")
response.Write("  						-----------------------------------------------------------------------------------------<br>")
response.Write("        &nbsp;&nbsp;在上面填写本程序的数据库路径全名,本程序的默认备份数据库文件为DataBackup\AspEaseAuction_Backup.MDB,请按照您的备份文件自行修改。<br>")
response.Write("  						&nbsp;&nbsp;您可以用这个功能来备份您的法规数据,以保证您的数据安全!<br>")
response.Write("        &nbsp;&nbsp;注意:所有路径都是相对与程序空间根目录的相对路径 </td>")
response.Write("  				</tr>	")
response.Write("  				</form>")
response.Write("  			</table>")
end sub

'====================备份数据库=========================
sub BackupData()
response.Write("	<table border=""0"" cellspacing=""1"" cellpadding=""5"" height=""1"" align=center width=""95%"" class=""tableBorder"">")
response.Write("  				<tr>  					")
response.Write("    <th height=25 > &nbsp;&nbsp;<B>备份拍卖数据</B>( 需要FSO支持 ) </th>")
response.Write("  				</tr>")
response.Write("  				<form method=""post"" action=""ADMIN_data.asp?action=BackupData&act=Backup"">")
response.Write("  				<tr>")
response.Write("  					<td height=100 class=""row"">")
response.Write("  						&nbsp;&nbsp;")
response.Write("						当前数据库路径(相对路径):")
response.Write("        <input type=text size=30 name=DBpath value=""")
response.Write(db)
response.Write(""">")
response.Write("        <BR>&nbsp;&nbsp;")
response.Write("						备份数据库目录(相对路径):")
response.Write("        <input type=text size=30 name=bkfolder value=Databackup>")
response.Write("        &nbsp;如目录不存在,程序将自动创建<BR>&nbsp;&nbsp;")
response.Write("						备份数据库名称(填写名称):")
response.Write("        <input type=text size=30 name=bkDBname value=AspEaseAuction_Backup.MDB>")
response.Write("        &nbsp;如备份目录有该文件,将覆盖,如没有,将自动创建<BR>")
response.Write("						&nbsp;&nbsp;<input type=submit value=""确定""><br>")
response.Write("  						-----------------------------------------------------------------------------------------<br>")
response.Write("        &nbsp;&nbsp;在上面填写本程序的数据库路径全名,本程序的默认数据库文件为Data\AspEaseAuction.MDB,<B>请一定不能用默认名称命名备份数据库</B><br>")
response.Write("  						&nbsp;&nbsp;您可以用这个功能来备份您的法规数据,以保证您的数据安全!<br>")
response.Write("        &nbsp;&nbsp;注意:所有路径都是相对与程序空间根目录的相对路径 </td>")
response.Write("  				</tr>	")
response.Write("  				</form>")
response.Write("  			</table>")
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 "备份数据库成功,您备份的数据库路径为" &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


'====================压缩数据库 =========================
sub CompressData()
response.Write("<table border=""0""  cellspacing=""1"" cellpadding=""5"" height=""1"" align=center width=""95%"" class=""tableBorder"">")
response.Write("<form action=""Admin_data.asp?action=CompressData"" method=""post"">")
response.Write("<tr>")
response.Write("<th height=25>")
response.Write("  					&nbsp;&nbsp;压缩数据库")
response.Write("</th></tr>")
response.Write("<tr>")
response.Write("<td class=""row"" height=25><b>注意:</b><br>输入数据库所在相对路径,并且输入数据库名称(正在使用中数据库不能压缩,请选择备份数据库进行压缩操作) </td>")
response.Write("</tr>")
response.Write("<tr>")
response.Write("<td class=""row"">压缩数据库:<input type=""text"" name=""dbpath"" value=")
response.Write(db)
response.Write(">&nbsp;")
response.Write("<input type=""submit"" value=""开始压缩""></td>")
response.Write("</tr>")
response.Write("</form>")
response.Write("</table>")
dbpath = request("dbpath")
If dbpath <> "" Then
dbpath = server.mappath(dbpath)
fname=left(dbPath,instrrev(DBPath,"\"))
	Set Fso=server.createobject("scripting.filesystemobject")
		if fso.fileexists(dbpath) then			
			fso.copyfile dbpath,Server.MapPath("databak")&".mdb"			
		Else
			response.write "数据库名称或路径不正确. 请重试!"
			response.end
		End if
		CompactDB(Server.MapPath("databak")&".mdb")		
		fso.copyFile Server.MapPath("databak")&".mdb",dbpath
		fso.deletefile Server.MapPath("databak")&".mdb"
set fso=nothing
response.write "你的数据库, " & dbpath & ", 已经压缩成功!" & vbCrLf
End If
end sub
Function CompactDB(dbPath)
Dim fso, jro, strDBPath,JET_3X
strDBPath = left(dbPath,instrrev(DBPath,"\"))
Set fso = CreateObject("Scripting.FileSystemObject")

If fso.FileExists(dbPath) Then
Set jro = CreateObject("JRO.JetEngine")	
jro.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 jro = 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 & "&nbsp;Byte" 
 		if size>1024 then
 		   size=(size\1024)
 		   showsize=size & "&nbsp;KB"
 		end if
 		if size>1024 then
 		   size=(size/1024)
 		   showsize=formatnumber(size,2) & "&nbsp;MB"		
 		end if
 		if size>1024 then
 		   size=(size/1024)
 		   showsize=formatnumber(size,2) & "&nbsp;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 & "&nbsp;Byte" 
 		if size>1024 then
 		   size=(size\1024)
 		   showsize=size & "&nbsp;KB"
 		end if
 		if size>1024 then
 		   size=(size/1024)
 		   showsize=formatnumber(size,2) & "&nbsp;MB"		
 		end if
 		if size>1024 then
 		   size=(size/1024)
 		   showsize=formatnumber(size,2) & "&nbsp;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("images")
 		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("images")
 		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 	
'=========================================================
'Copyright (C) 2003-2004 AspEase.Com. All rights reserved.
'Web: http://www.aspease.com
'Email: byhucn@126.com,lzz9812@163.com
'=========================================================
'
'FileName: admin_data.asp
'Version:2.0
'UpdateTime: 2004-10-7 15:11:27
'Script Written by www.aspease.com 
'=========================================================%>

⌨️ 快捷键说明

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