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

📄 admin_data.asp

📁 商机网站8.0,比教完整,可以自己二次开发!
💻 ASP
字号:
<!--#include file="conn.asp"-->
<!--#include file="head.asp"-->

<%if session("userkey")=4 then%>
<%call main()%>
<%else%>
<script language=javascript>  
alert( "错误:您无权进行模版管理!"  );
location.href = "javascript:history.back()"  
</script>
<%end if%>

<%sub main()%>
<table width="100%" border="0" cellspacing="3" cellpadding="3"><tr><td height="20">当前位置:<a href=main.asp>管理首页</a> >> <a href=admin_data.asp>数据管理</a></td></tr></table>
<table width="95%" cellspacing="1" cellpadding="5" bgcolor="#999999" align="center">
<tr bgcolor="#CCCCCC" align=center><td><b>数据管理</b></td></tr>
<tr bgcolor="#ffffff" height=25><td>【<a href=admin_data.asp?action=seeserver>查看服务器变量</a>】【<a href=admin_data.asp?action=backupdata>备份数据</a>】【<a href=admin_data.asp?action=restoredata>恢复数据</a>】【<a href=admin_data.asp?action=dosql>执行SQL语句</a>】【<a href=admin_data.asp?action=updateclass>更新总类商业信息</a>】【<a href=admin_data.asp?action=updateboard>更新子类商业信息数</a>】</td></tr>
</table>
<%
if Request("action") = "seeserver" then
	call seeserver()
elseif request("action") = "backupdata" then
	call backupdata()
elseif request("action") = "restoredata" then
	call restoredata()
elseif request("action") = "dosql" then
	call dosql()
elseif request("action") = "updateuser" then
	call updateuser()
elseif request("action") = "updateclass" then
	call updateclass()
elseif request("action") = "updateboard" then
	call updateboard()
elseif request("action") = "updatetopic" then
	call updatetopic()

else
	call data()
end if
%>
<%end sub%>


<%sub data()%>

<%end sub%>




<%sub seeserver()
Dim theInstalledObjects(17)
theInstalledObjects(0) = "MSWC.AdRotator"
theInstalledObjects(1) = "MSWC.BrowserType"
theInstalledObjects(2) = "MSWC.NextLink"
theInstalledObjects(3) = "MSWC.Tools"
theInstalledObjects(4) = "MSWC.Status"
theInstalledObjects(5) = "MSWC.Counters"
theInstalledObjects(6) = "IISSample.ContentRotator"
theInstalledObjects(7) = "IISSample.PageCounter"
theInstalledObjects(8) = "MSWC.PermissionChecker"
theInstalledObjects(9) = "Scripting.FileSystemObject"
theInstalledObjects(10) = "adodb.connection"
theInstalledObjects(11) = "SoftArtisans.FileUp"
theInstalledObjects(12) = "SoftArtisans.FileManager"
theInstalledObjects(13) = "JMail.SMTPMail"
theInstalledObjects(14) = "CDONTS.NewMail"
theInstalledObjects(15) = "Persits.MailSender"
theInstalledObjects(16) = "LyfUpload.UploadFile"
theInstalledObjects(17) = "Persits.Upload.1"
%>
<br><table width="95%" cellspacing="1" cellpadding="5" align=center bgcolor=999999>
<tr bgcolor=#ffcc00><td colspan="2"  height=25><b>服务器有关的变量</b></td></tr>
<tr bgcolor=#efefef><td valign=top>显示客户发出的所有HTTP标题</td><td><%=request.ServerVariables("All_Http")%></td></tr>
<tr bgcolor=#efefef><td valign=top>检取ISAPIDLL的metabase路径</td><td><%=request.ServerVariables("APPL_MD_PATH")%></td></tr>
<tr bgcolor=#efefef><td valign=top>显示站点物理路径</td><td><%=request.ServerVariables("APPL_PHYSICAL_PATH")%></td></tr>
<tr bgcolor=#efefef><td valign=top>路径信息</td><td><%=request.ServerVariables("PATH_INFO")%></td></tr>
<tr bgcolor=#efefef><td valign=top>显示请求机器IP地址</td><td><%=request.ServerVariables("REMOTE_ADDR")%></td></tr>
<tr bgcolor=#efefef><td valign=top>服务器IP地址</td><td><%=Request.ServerVariables("LOCAL_ADDR")%></td></tr>
<tr bgcolor=#efefef><td valign=top>显示执行SCRIPT的虚拟路径</td><td><%=request.ServerVariables("SCRIPT_NAME")%></td></tr>
<tr bgcolor=#efefef><td valign=top>返回服务器的主机名,DNS别名,或IP地址</td><td><%=request.ServerVariables("SERVER_NAME")%></td></tr>
<tr bgcolor=#efefef><td valign=top>返回服务器处理请求的端口</td><td><%=request.ServerVariables("SERVER_PORT")%></td></tr>
<tr bgcolor=#efefef><td valign=top>协议的名称和版本</td><td><%=request.ServerVariables("SERVER_PROTOCOL")%></td></tr>
<tr bgcolor=#efefef><td valign=top>服务器的名称和版本</td><td><%=request.ServerVariables("SERVER_SOFTWARE")%></td></tr>
<tr bgcolor=#efefef><td valign=top>服务器操作系统</td><td><%=Request.ServerVariables("OS")%></td></tr>
<tr bgcolor=#efefef><td valign=top>脚本超时时间</td><td><%=Server.ScriptTimeout%> 秒</td></tr>
<tr bgcolor=#efefef><td valign=top>服务器CPU数量</td><td><%=Request.ServerVariables("NUMBER_OF_PROCESSORS")%> 个</td></tr>
<tr bgcolor=#efefef><td valign=top width=30%>服务器解译引擎</td><td><%=ScriptEngine & "/"& ScriptEngineMajorVersion &"."&ScriptEngineMinorVersion&"."& ScriptEngineBuildVersion %></td></tr>
</table>
<br><table width="95%" cellspacing="1" cellpadding="5" align=center bgcolor=999999>
<tr bgcolor=#ffcc00><td colspan="3" height=25 ><b>组件支持情况</b></td></tr>
<tr><td colspan="3" height=25 bgcolor=#f8f8f8 ><b>--IIS自带组件</td></tr>
<tr height=22 align=center bgcolor=#cccccc><td width="70%">组 件 名 称</td><td width="15%">支 持</td><td width="15%">不支持</td></tr>
<%dim i
For i=0 to 10
Response.Write "<TR bgcolor=#efefef align=center height=20><TD align=left>&nbsp;" & theInstalledObjects(i) & "<font color=#888888>&nbsp;"
select case i
case 9
Response.Write "(FSO 文本文件读写)"
case 10
Response.Write "(ACCESS 数据库)"
end select
Response.Write "</font></td>"
If Not IsObjInstalled(theInstalledObjects(i)) Then 
Response.Write "<td></td><td><font color=red><b>×</b></font></td>"
Else
Response.Write "<td><b>√</b></td><td></td>"
End If
Response.Write "</TR>" & vbCrLf
Next
%>
<tr><td colspan="3" height=25 bgcolor=#f8f8f8 ><b>--其他常见组件</td></tr>
<tr height=22 align=center bgcolor=#cccccc><td width="70%">组 件 名 称</td><td width="15%">支 持</td><td width="15%">不支持</td></tr>
<% For i=11 to UBound(theInstalledObjects)
Response.Write "<TR align=center height=20 bgcolor=#efefef><TD align=left>&nbsp;" & theInstalledObjects(i) & "<font color=#888888>&nbsp;"
select case i
case 11
Response.Write "(SA-FileUp 文件上传)"
case 12
Response.Write "(SA-FM 文件管理)"
case 13
Response.Write "(JMail 邮件发送)"
case 14
Response.Write "(CDONTS 邮件发送 SMTP Service)"
case 15
Response.Write "(ASPEmail 邮件发送)"
case 16
Response.Write "(LyfUpload 文件上传)"
case 17
Response.Write "(ASPUpload 文件上传)"
end select
Response.Write "</font></td>"
If Not IsObjInstalled(theInstalledObjects(i)) Then 
Response.Write "<td></td><td><font color=red><b>×</b></font></td>"
Else
Response.Write "<td><b>√</b></td><td></td>"
End If
Response.Write "</TR>" & vbCrLf
Next
%>
</table>
<hr size=1 width=95%><br><br>
<%
end sub
Function IsObjInstalled(strClassString)
On Error Resume Next
IsObjInstalled = False
Err = 0
Dim xTestObj
Set xTestObj = Server.CreateObject(strClassString)
If 0 = Err Then IsObjInstalled = True
Set xTestObj = Nothing
Err = 0
End Function
%>




<%sub backupdata()%>
<br>
<table width=95% cellspacing=1 cellpadding=5 bgcolor=999999 align=center>		  							  				
<tr bgcolor=ffcc00><td height=25 >&nbsp;&nbsp;<b>备份论坛数据</b> ( 需要FSO支持,FSO相关帮助请看微软网站 )</td></tr> 	
<%fsoflag=1
  if fsoflag="1" then			
  dim method
  method=request.querystring("method")
  if method="" then  					
  %>
<form method="post" action="admin_data.asp?action=backupdata&method=Backup">
<tr bgcolor=eeeeee><td height=100 >
&nbsp;&nbsp;数据库路径(相对):<input type=text size=30 name=DBpath value=dircool.mdb>&nbsp;&nbsp;<input type=submit value="确定"> | 请注意:本功能需要FSO支持<br>
-----------------------------------------------------------------------------------------<br>
&nbsp;&nbsp;在上面填写本程序的数据库路径全名,本程序的默认数据库文件为weimin.mdb<br>
&nbsp;&nbsp;您可以用这个功能来备份您的法规数据,以保证您的数据安全!<br>
&nbsp;&nbsp;注意:所有路径都是相对与程序空间根目录的相对路径。					
</td></tr></form>
<%
elseif method="Backup" then		  				
Dbpath=request.form("Dbpath")
Dbpath=server.mappath(Dbpath)		  				
Set Fso=server.createobject("scripting.filesystemobject")
if fso.fileexists(dbpath) then  		
fso.copyfile dbpath,left(dbpath,instrrev(dbpath,"\",(instrrev(dbpath,"\")-1)))&"admin\dircool_back.mdb"
response.write "<tr><td bgcolor=#efefef height=25><li>成功备份数据</td></tr>"
else
response.write "<tr><td bgcolor=#e1e6ec height=25><li>找不到您所需要备份的文件</td></tr>"	
end if
end if	
else
%>  							
<tr><td height=30><li>本项功能已经被管理员关闭</td></tr>
<%end if%>
</table>	
<%end sub%>


<%sub restoredata()%>
<br>
<table width=95% cellspacing=1 cellpadding=5 bgcolor=999999 align=center>	  							  				
<tr bgcolor=ffcc00><td height=25 >&nbsp;&nbsp;<b>恢复论坛数据</b> ( 需要FSO支持,FSO相关帮助请看微软网站 )</td></tr>
<%
fsoflag=1
if fsoflag="1" then 
dim method
method=request.querystring("method")
if method="" then  					
%>
<form method="post" action="admin_data.asp?action=restoredata&method=Restore">
<tr bgcolor=eeeeee><td height=100 >
&nbsp;&nbsp;数据库路径(相对):<input type=text size=30 name=DBpath value="dircool_back.mdb">&nbsp;&nbsp;<input type=submit value="确定"> | 请注意:本功能需要FSO支持<br>
-----------------------------------------------------------------------------------------<br>
&nbsp;&nbsp;在上面填写本程序的数据库路径全名,本程序的备份数据库文件为eoknews_Backup.MDB<br>
&nbsp;&nbsp;您可以用这个功能来恢复您的程序数据,以保证您的数据安全!<br>
&nbsp;&nbsp;注意:所有路径都是相对与程序空间根目录的相对路径。
</td></tr></form>
<%
elseif method="Restore" then
Dbpath=request.form("Dbpath")
if dbpath="" then
response.write "<tr><td bgcolor=#efefef height=25><li>请输入您要恢复成的数据库全名</td></tr>"	
else
Dbpath=server.mappath(Dbpath)
end if  				
Backpath=left(dbpath,instrrev(dbpath,"\",(instrrev(dbpath,"\")-1)))&"admin\dircool_back.mdb"
'Response.write Backpath
Set Fso=server.createobject("scripting.filesystemobject")
if fso.fileexists(Backpath) then  					
fso.copyfile Backpath,Dbpath
response.write "<tr><td bgcolor=#efefef height=25><li>成功恢复数据!</td></tr>"
else
response.write "<tr><td bgcolor=#efefef height=25><li>备份目录下并无您的备份文件!</td></tr>"	
end if	
end if
else%>  							
<tr><td height=30 ><li>本项功能已经被管理员关闭</td></tr>
<%end if%>
</table>	
<%end sub%>



<%sub dosql()%>
<br>
<table width=95% cellspacing=1 cellpadding=5  align=center>
<tr ><td><p><b>SOL语句执行操作</b></p>
<p>注意:本操作仅限高级、对SQL编程比较熟悉的用户,您可以直接输入sql执行语句。

在操作前请慎重考虑您的执行语句是否正确和完整,执行后不可恢复。</p></td></tr>
<tr ><td>	
<%
if request("method") = "go" then
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 "<br><center><font color=red>SQL命令执行成功!</font>"
'response.redirect"admin_data.asp?action=dosql"
else
response.write "<br><center>语句有问题,具体出错如下:<br><br><font color=red>"
response.write Err.Description
response.write "</font>"
err.clear
end if
end if
else
%>
<table cellspacing="3" cellpadding="0">
<tr><td width="100%" >
<Form Name=FormPst Method=Post Action="admin_data.asp?action=dosql&method=go">
<FieldSet><Legend>请输入SQL语句</Legend>
<br>指令:<Input type="text" name="SQL_Statement" Size=80><br> 
<p align=center><Input type="Submit" Value="送出">  <Input type="reset" Value="清除"><br><br></p>
</FieldSet>
</Form></td></tr></table>
<%end if%>
<%end sub%>



	
	
	
<%sub updateclass()%>
<table width="95%" cellspacing="1" cellpadding="5" bgcolor=#999999 align=center>
 <tr bgcolor=#cccccc><td><center><b><font color=red>数据更新成功</font></b></td></tr>
        <%
	set rs=server.createobject("adodb.recordset")
	sql="select bid,bname from [big] order by bid desc"
	rs.open sql,conn,1,1
	do while not rs.eof
	set rs1=server.createobject("adodb.recordset")
	sql1="select * from [site] where bid="&rs("bid")&""
	rs1.open sql1,conn,1,1
	classTopic=RS1.RecordCount
	conn.execute("update [big] set bNum="&classTopic&" where bid="&rs("bid")&"")
	rs1.close
	rs.movenext
	loop
	rs.close
	set rs=nothing
	
	set rs=server.createobject("adodb.recordset")
	sql="select * from [big] order by bid desc"
	rs.open sql,conn,1,1
	
	do while not rs.eof %>
	<tr bgcolor=#eeeeee><td>总类 <font color=blue><%=rs("bname")%></font>&nbsp;共有&nbsp;<font color=red><%=rs("bNum")%></font> 个商业信息网</td></tr>
	
	<%rs.movenext
	loop
	rs.close
	set rs=nothing
	%>
	</table><%
	end sub%>


<%sub updateboard()%>
<table width="95%" cellspacing="1" cellpadding="5" bgcolor=#999999 align=center>
 <tr bgcolor=#cccccc><td><center><b><font color=red>数据更新成功</font></b></td></tr>
        <%
        
	set rs=server.createobject("adodb.recordset")
	sql="select sid,sname from [small] order by sid desc"
	rs.open sql,conn,1,1
	do while not rs.eof
	set rs1=server.createobject("adodb.recordset")
	sql1="select * from [site] where sid="&rs("sid")&""
	rs1.open sql1,conn,1,1
	boardTopic=RS1.RecordCount
	conn.execute("update [small] set sNum="&boardTopic&" where sid="&rs("sid")&"")
	rs1.close
	rs.movenext
	loop
	rs.close
	set rs=nothing
	
	set rs=server.createobject("adodb.recordset")
	sql="select * from [small] order by sid desc"
	rs.open sql,conn,1,1
	
	do while not rs.eof %>
	<tr bgcolor=#eeeeee><td>子类 <font color=blue><%=rs("sname")%></font>&nbsp;共有&nbsp;<font color=red><%=rs("sNum")%></font> 个商业信息网</td></tr>
	
	<%rs.movenext
	loop
	rs.close
	set rs=nothing
	%>
	</table><%
	end sub%>

⌨️ 快捷键说明

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