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

📄 admindata.asp

📁 一路飞扬在线同学录单班级版,主要用于个人系统中的同学录,不过对于学习有帮助!
💻 ASP
字号:
<!--#include file="inc/db.inc"-->
<!-- #include file="inc/func.inc" -->
<%
userid=session("myuserid")
password=session("mypwd")
if isman(userid,password)=0 then
%>
<script>
alert("你不是管理员,无权进入!");
parent.location.href="index.asp";
</script>
<%
else
	set rs=server.createobject("adodb.recordset")

	sql="select manclass from [txluser] where userid='"&userid&"'"

	rs.open sql,conn,1,1
	manclass=rs("manclass")
	set rs=nothing%>
<html>
<title>数据库管理</title>
<LINK href="jscs/css.CSS" type=text/css rel=stylesheet>
<body>
<%
	sub backupdata()
		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)
    Set fso1 = CreateObject("Scripting.FileSystemObject")
        Set f = fso1.CreateFolder(foldername)
        MakeNewsDir = True
    Set fso1 = nothing
End Function
%>


<%sub showing()
tablebackcolor="#0099CC"
tabletitlecolor="#99CCFF"
tablebodycolor="#F2F8FF"
tablecontentcolor="#000000"
attablebackcolor="#0099CC"
tablewidth="80%"
%>
<table cellpadding=0 cellspacing=0 border=0 width=<%=tablewidth%> bgcolor=<%=tablebackcolor%> align=center>
  <tr>
    <td>
      <table cellpadding=3 cellspacing=1 border=0 width=100%>
        <tr bgcolor='<%=Tabletitlecolor%>'>
        <td align=center colspan="2"><font color="<%=TableFontColor%>">欢迎<b><%=session("myuserid")%></b>进入数据库管理页面</font>
        </td>
        </tr>
            <tr bgcolor=<%=tablebodycolor%>>
              <td width="100%" valign=top><font color="<%=TableContentColor%>">
		 		<table width=100% cellspacing=0 cellpadding=0 bgcolor='<%=atablebackcolor%>'>		  							  				
  				<tr bgcolor=<%=tablebodycolor%>>
  					<td height=25 ><font color="<%=TableContentColor%>">
  					&nbsp;&nbsp;<B>备份网站数据</B>( 需要FSO支持,FSO相关帮助请看微软网站 )</font>
  					</td>
  				</tr>
  				<form method="post" action="admindata.asp?action=Backup">
  				<tr bgcolor=<%=tablebodycolor%>>
  					<td height=100 ><font color="<%=TableContentColor%>">
  						&nbsp;&nbsp;
						当前数据库路径(相对路径):<input type=text size=15 name=DBpath value="<%=db%>"><BR>&nbsp;&nbsp;
						备份数据库目录(相对路径):<input type=text size=15 name=bkfolder value=txldatabak>&nbsp;如目录不存在,程序将自动创建<BR>&nbsp;&nbsp;
						备份数据库名称(填写名称):<input type=text size=15 name=bkDBname value=txl.asp>&nbsp;如备份目录有该文件,将覆盖,如没有,将自动创建<BR>
						&nbsp;&nbsp;<input type=submit value="确定"><br><div align=center>
  						-----------------------------------------------------------------------------</div><br>
  						&nbsp;&nbsp;在上面填写本程序的数据库路径全名,本程序的默认数据库文件为db\txl.asp<br>
  						&nbsp;&nbsp;您可以用这个功能来备份您的法规数据,以保证您的数据安全!<br>
  						&nbsp;&nbsp;注意:所有路径都是相对与程序空间根目录的相对路径				</font>
  					</td>
  				</tr>	
  				</form></table>
</font>
          </td>
            </tr>
        </table>
        </td>
    </tr>

</table>

<br>
<table cellpadding=0 cellspacing=0 border=0 width=<%=tablewidth%> bgcolor=<%=tablebackcolor%> align=center>
  <tr>
    <td>
      <table cellpadding=3 cellspacing=1 border=0 width=100%>
        
            <tr bgcolor=<%=tablebodycolor%>>
              <td width="100%" valign=top><font color="<%=TableContentColor%>">
		 			<table width=100% cellspacing=0 cellpadding=0 bgcolor='<%=atablebackcolor%>'>		  							  				
  				<tr bgcolor=<%=tablebodycolor%>>
  					<td height=25 ><font color="<%=TableContentColor%>">
   					&nbsp;&nbsp;<B>恢复网站数据</B>( 需要FSO支持,FSO相关帮助请看微软网站 )</font>
  					</td>
  				</tr>
  				<form method="post" action="ADMINData.asp?action=Restore">
  				<tr bgcolor=<%=tablebodycolor%>>
  					<td height=100 ><font color="<%=TableContentColor%>">
  						&nbsp;&nbsp;备份数据库路径(相对):<input type=text size=30 name=DBpath value="Databak/txl.asp">&nbsp;&nbsp;<BR>
  						&nbsp;&nbsp;目标数据库路径(相对):<input type=text size=30 name=backpath value="<%=db%>"><BR>&nbsp;&nbsp;填写您当前使用的数据库路径,如不想覆盖当前文件,可自行命名(注意路径是否正确),然后修改db.inc文件,如果目标文件名和当前使用数据库名一致的话,不需修改db.inc文件<BR>
						&nbsp;&nbsp;<input type=submit value="恢复数据"> <br><div align=center>
  						-----------------------------------------------------------------------------</div><br>
  						&nbsp;&nbsp;在上面填写本程序的数据库路径全名,本程序的默认备份数据库文件为databak\txl.asp,请按照您的备份文件自行修改。<br>
  						&nbsp;&nbsp;您可以用这个功能来备份您的法规数据,以保证您的数据安全!<br>
  						&nbsp;&nbsp;注意:所有路径都是相对与程序空间根目录的相对路径</font>
  					</td>
  				</tr>	
  				</form>
  			</table>
</font>
			  </td>
            </tr>
        </table>
        </td>
    </tr>
</table>
<br>
<%if manclass=2 then%>
<table cellpadding=0 cellspacing=0 border=0 width=<%=tablewidth%> bgcolor=<%=tablebackcolor%> align=center>
  <tr>
    <td>
      <table cellpadding=3 cellspacing=1 border=0 width=100%>
                    <tr bgcolor=<%=tablebodycolor%>>
              <td width="100%" valign=top><p>
              <table width="100%" border="0" cellspacing="3" cellpadding="0">
      <tr><td bgcolor=<%=atabletitlecolor%>><font color="<%=TableContentColor%>"><p><b>SOL语句执行操作</b>:本操作仅限高级、对SQL编程比较熟悉的用户,您可以直接输入sql执行语句,比如delete from bbs1 where username='test'进行删除某用户帖子操作,在操作前请慎重考虑您的执行语句是否正确和完整,执行后不可恢复。</p></font></font>
                  </td>
                </tr>
                <tr> 
                  <td>	<font color="<%=TableContentColor%>">

              <table width="80%" border="0" cellspacing="3" cellpadding="0">
                <tr> 
                  <td width="100%" height="2"><font color="<%=TableContentColor%>">
<Form Name=FormPst Method=Post Action="admindata.asp?action=save">
<FieldSet>
<Legend>请输入SQL语句</Legend>
指令:<Input type="text" name="SQL_Statement" Size=60> <p>
<Input type="Submit" Value="送出"> <p>
</FieldSet>
</Form></font>
                  </td>
                </tr>
              </table>
</font>
		</td>
            </tr>
        </table>
        </td>
    </tr>
</table>
<%end if
end sub
%>
<%	db="txl_db/txl_w013.asp"
	if request("action")="Backup" then
	call backupdata()
	elseif request("action")="Restore" then
	dim dbpath,backpath,fso
	Dbpath=request.form("Dbpath")
	backpath=request.form("backpath")
	if dbpath="" then
	response.write "请输入您要恢复成的数据库全名"	
	else
	Dbpath=server.mappath(Dbpath)
	end if
	backpath=server.mappath(backpath)
	'Response.write Backpath
	Set Fso=server.createobject("scripting.filesystemobject")
	if fso.fileexists(dbpath) then  					
		fso.copyfile Dbpath,Backpath
		response.write "成功恢复数据!"
	else
		response.write "备份目录下并无您的备份文件!"	
	end if

	elseif request("action") = "save" then
	dim SQL_Statement
	SQL_Statement=Request("SQL_Statement")
	if SQL_Statement<>Empty then
	On Error Resume Next 
	conn.Execute(SQL_Statement)
	if err.number="0" then
	response.write "执行成功"
	else
	response.write "语句有问题,具体出错如下:<br>"
	response.write Err.Description
	err.clear
	end if
	end if

	else
	call showing()
	end if
	%>
</body>
</html>
<%end if%>

⌨️ 快捷键说明

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