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

📄 admin_server.asp

📁 正版创力4.1SQL商业版!!!ASP版。
💻 ASP
📖 第 1 页 / 共 2 页
字号:
<!--#include file="Inc/Const.asp"-->
<%
if Not Cl.Admin_Purview(0)="1" then Cl.ShowErr("<li>您无此操作权限!</li>")
dim Action,ServerID,ProjectID
Action=Trim(request("Action"))
ProjectID	=Cl.GetClng(request("ProjectID"))
ServerID=Cl.GetClng(request("ServerID"))
Header
%>
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="border">
  <tr class="title"> 
    <td height="22" colspan="2" align="center"><strong>下载服务器管理</strong></td>
  </tr>
  <tr class="tdbg"> 
    <td width="70" height="30"><strong>管理导航:</strong></td>
    <td><a href="Admin_Server.asp">服务器管理首页</a> | <a href="Admin_Server.asp?Action=Add&ProjectID=<%=ProjectID%>">添加新方案</a><%
	if ProjectID>0 then 
	%> | <a href="Admin_Server.asp?Action=OrderID&ProjectID=<%=ProjectID%>">修改服务器排序</a>  | <a href="Admin_Server.asp?Action=AddServer&ProjectID=<%=ProjectID%>">添加新服务器</a><%
	end if
	%></td>
  </tr>
</table>
<%
Select Case Action
Case "Add","Modify"
	call ProjectInfo()
Case "SaveAdd","SaveModify"
	call SaveProjectInfo()
Case "AddServer","ModifyServer"
	call ServerInfo()
Case "SaveAddServer","SaveModifyServer"
	call SaveServerInfo()
Case "DelServer"
	call DelServer()
Case "Del"
	call DelProject()
Case "OrderID"
	call OrderID()
Case "UpOrder"
	call UpOrder() 
Case "DownOrder"
	call DownOrder()
Case "IsDisabled"
	Call IsDisabled()
Case "CIsDisabled"
	Call CIsDisabled()
Case else
	Call ProjectMain()
end Select

Footer

Sub ProjectMain()
	if ProjectID>0 then ServerMain : Exit Sub
	SQL="Select ProjectID,ProjectName,ProjectIntro,IsDisabled from Cl_ServerProject order by ProjectID"
	Set rs= Server.CreateObject("ADODB.Recordset")
	OpenConn : rs.open sql,Conn,1,1
	%>
<br />
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="border">
  <tr class="title">
    <td width="50" align="center"><strong>ID</strong></td>
    <td width="120" align="center"><strong>方案名称</strong></td>
    <td align="center"><strong>方案说明</strong></td>
    <td width="120" align="center"><strong>方案属性</strong></td>
    <td width="300" height="22" align="center"><strong>常规操作</strong></td>
  </tr>
  <%
if Not (rs.Bof and rs.Eof) then
	'TotalPut=rs.recordcount
	'if (TotalPut mod PageSize)=0 then
	'	TotalPages = TotalPut \ PageSize
	'else
	'	TotalPages = TotalPut \ PageSize + 1
	'end if
	'if CurrentPage > TotalPages then CurrentPage=TotalPages
	'if CurrentPage < 1 then CurrentPage=1
	'rs.move (CurrentPage-1)*PageSize
	SQL = rs.GetRows(-1)
	For i=0 to Ubound(SQL,2)
  %>
  <tr class="tdbg" onMouseOut="this.className='tdbg'" onMouseOver="this.className='tdbg2'"> 
    <td width="50" align="center"><b><%=SQL(0,i)%></b></td>
    <td width="120" align="center"><a href="Admin_Server.asp?Action=ServerMain&ProjectID=<%=SQL(0,i)%>"><%=SQL(1,i)%></a></td>
    <td align="center"><%=SQL(2,i)%></td>
    <td width="120" align="center"></td>
	<td width="300" align="center">
		<a href="Admin_Server.asp?Action=AddServer&ProjectID=<%=SQL(0,i)%>"><font color=#0000ff>添加服务器</font></a>&nbsp;
		<a href="Admin_Server.asp?Action=ServerMain&ProjectID=<%=SQL(0,i)%>"><font color=#ff0033>管理服务器</font></a>&nbsp;
		<a href="Admin_Server.asp?Action=Modify&ProjectID=<%=SQL(0,i)%>">修改方案</a>&nbsp;
		<a href="Admin_Server.asp?Action=Del&ProjectID=<%=SQL(0,i)%>" onClick="return confirm('确定要删除此方案吗?如果是,系统会自动把此方案下的服务器一起删除,此操作不可恢复!');">删除方案</a>
	</td>
  </tr>
  <%
	Next
	SQL=Empty
	End if
	%>
</table>
<%
	'Response.write Cl.ShowPage(FileName,TotalPut,PageSize,"个","方案")
	rs.Close:set rs=Nothing
End Sub

Sub ServerMain()
	Set rs=Cl.Execute("Select ServerID,ProjectID,ServerName,ServerAddress,OrderID,DownGroup,DownPoint,DownMoney,IsDisabled from Cl_Server Where ProjectID="&ProjectID&" order by OrderID")
	%>
<br />
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="border">
  <tr class="title">
    <td width="50" align="center"><strong>ID</strong></td>
    <td height="22" align="center" width="120"><strong>服务器名称</strong></td>
    <td align="center"><strong>服务器地址</strong></td>
	<td width="80" align="center"><strong>下载级别</strong></td>
    <td width="60" align="center"><strong>下载<%=Cl.Web_Setting(28)%></strong></td>
    <td width="60" align="center"><strong>下载<%=Cl.Web_Setting(26)%></strong></td>
    <td width="50" align="center"><strong>排序ID</strong></td>
    <td width="40" align="center"><strong>状态</strong></td>
    <td width="60" height="22" align="center"><strong>常规操作</strong></td>
  </tr>
  <%
  if rs.Bof and rs.Eof then

  else
	SQL=rs.GetRows(-1)
	For i=0 to Ubound(SQL,2)
	%>
	<tr class="tdbg" onMouseOut="this.className='tdbg'" onMouseOver="this.className='tdbg2'"> 
		<td width="50" align="center"><b><%=SQL(0,i)%></b></td>
		<td align="center" width="120"><%=SQL(2,i)%></td>
		<td><%=SQL(3,i)%></td>
		<td width="80" align="center"><span title="<%=Cl.GetUserGroupName(SQL(5,i))%>"><%=SQL(5,i)%></span></td>
		<td width="60" align="center"><b><font color=#ff0033><%=SQL(6,i)%></font></b></td>
		<td width="60" align="center"><b><font color=#ff0033><%=SQL(7,i)%></font></b></td>
		<td width="60" align="center"><%=SQL(4,i)%></td>
		<td width="40" align="center"><%
		if SQL(8,i)=False then
			response.write "<a href='Admin_Server.asp?Action=IsDisabled&ProjectID=" & ProjectID & "&ServerID="&SQL(0,i)&"' title='点击禁用'><font color=#0000ff>启用</font></a>"
		else
			response.write "<a href='Admin_Server.asp?Action=CIsDisabled&ProjectID=" & ProjectID & "&ServerID="&SQL(0,i)&"' title='点击启用'><font color=#ff0033>禁用</font></a>"
		end if%></td>
		<td width="60" align="center"><%
		response.write "&nbsp;<a href='Admin_Server.asp?Action=ModifyServer&ProjectID=" & ProjectID & "&ServerID="&SQL(0,i)&"'>修改</a>&nbsp;"
		response.write "<a href='Admin_Server.asp?Action=DelServer&ProjectID=" & ProjectID & "&ServerID="&SQL(0,i)&"' onClick=""return confirm('确定要删除此服务器吗?');"">删除</a>"
		%></td>
	</tr>
	<%
		Next
		SQL=Empty
	End if
	%>
</table>
<%
	rs.Close:set rs=Nothing
end sub

sub ProjectInfo()
	dim sTemp
	dim sAction,SubmitValue
	dim ProjectName,ProjectIntro,IsDisabled
	if Action = "Modify" then
		sAction="SaveModify":SubmitValue="修 改"
		set rs=Cl.Execute("select * from Cl_ServerProject where ProjectID=" & ProjectID)
		if rs.bof and rs.eof then
			rs.close : Set Rs=Nothing
			Cl.ShowErr("<br /><li>找不到指定的记录!</li>")
		end if
		ProjectName	= rs("ProjectName")
		ProjectIntro	= rs("ProjectIntro")
		IsDisabled	= rs("IsDisabled")
		rs.close : set rs = Nothing
	else
		sAction = "SaveAdd"		: SubmitValue = "添 加"
		ProjectName	= "新方案"
		ProjectIntro	= ""
		IsDisabled	= False
	end if
%>
<br />
<script language="JavaScript" type="text/javascript">
function CheckForm()
{
	if (document.form1.ProjectName.value == "") {
		alert("请输入方案名称!");
		document.form1.ProjectName.focus();
		return false;
	}
	return true;
}
</script>
<form method="post" action="Admin_Server.asp" name="form1" onsubmit="return CheckForm();">
  <table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="border" >
    <tr class="title"> 
      <td height="22" colspan="2"> <div align="center"><strong><%=SubmitValue%> 方 案</strong></div></td>
    </tr>
    <tr class="tdbg">
      <td width="150" align="right"><strong>方案名称:</strong></td>
      <td><input name="ProjectName" type="text" id="ProjectName" value="<%=ProjectName%>" size="60" maxlength="200"> <font color=red>*</font></td>
    </tr>
    <tr class="tdbg">
      <td width="150" align="right"><strong>方案说明:</strong></td>
      <td><textarea name="ProjectIntro" cols="50" rows="5" id="ProjectIntro"><%=ProjectIntro%></textarea></td>
    </tr>
    <tr class="tdbg"> 
      <td width="150" align="right"><strong>是否禁用:</strong></td>
      <td> 
        <input type="radio" name="IsDisabled" value="0" <%if Not IsDisabled then%>checked<%end if%>>
        启&nbsp;&nbsp;用 &nbsp;&nbsp;&nbsp;&nbsp; 
        <input type="radio" name="IsDisabled" value="1" <%if IsDisabled then%>checked<%end if%>>
        禁&nbsp;&nbsp;用</td>
    </tr>
    <tr class="tdbg"> 
      <td colspan="2" align="center" class="tdbg">
		<input name="Action" type="hidden" id="Action" value="<%=sAction%>">
		<input name="ProjectID" type="hidden" id="ProjectID" value="<%=ProjectID%>"> 
        <input type="submit" name="Submit" value=" <%=SubmitValue%> "> &nbsp; <input name="Cancel" type="button" id="Cancel" value=" 取 消 " onClick="window.location.href='Admin_Server.asp'" style="cursor:hand;"></td>
    </tr>
  </table>
</form>
<%
end sub

sub SaveProjectInfo()
	dim sTemp
	dim ProjectName,ProjectIntro,IsDisabled
	ProjectName		= Trim(request("ProjectName"))
	ProjectIntro		= Trim(request("ProjectIntro"))
	IsDisabled		= Cl.GetClng(request("IsDisabled"))
	if ProjectName="" then
		Cl.ShowErr("<br /><li>服务器名或服务器地址不能为空!</li>")
	end if
	if IsDisabled=0 then
		IsDisabled=False
	else
		IsDisabled=True
	end if
	Set rs=Server.CreateObject("Adodb.RecordSet")
	if Action="SaveAdd" then
		OpenConn : rs.open "Select Top 1 * From Cl_ServerProject Where ProjectName='"&ProjectName&"'",Conn,1,3
		if Not Rs.Eof then
		Cl.ShowErr("<br /><li>数据库中已经存在着相同的方案名称,请重新输入!</li>")
		End if
		rs.addnew
		rs("AddTime")	= Cdate(FormatDateTime(Now(),1) & FormatDateTime(Now(),3))
	elseif Action="SaveModify" then
		OpenConn : rs.open "Select * From Cl_ServerProject Where ProjectID=" & ProjectID,Conn,1,3
		if rs.bof and rs.EOF then
			rs.close:set rs=Nothing
			Cl.ShowErr("<br /><li>找不到指定的记录!</li>")
		end if
	else
		Set rs=Nothing
		Cl.ShowErr("<br /><li>参数错误!</li>")
	end if
	rs("ProjectName")		= ProjectName
	rs("ProjectIntro")		= ProjectIntro
	rs("IsDisabled")	= IsDisabled
	rs.update
	rs.Close:set rs=Nothing
	Cl.SaveAdminLog
	Response.Redirect "Admin_Server.asp"
end sub

Sub DelProject()
	Cl.Execute("delete from Cl_Server Where ProjectID="&ProjectID)
	Cl.Execute("delete from Cl_ServerProject Where ProjectID="&ProjectID)
	Cl.SaveAdminLog
	Response.Redirect "Admin_Server.asp"
End Sub

sub ServerInfo()
	dim sTemp
	dim sAction,SubmitValue
	dim ServerName,ServerAddress,ReadMe,DownGroup,DownPoint,DownMoney,IsDisabled
	if Action = "ModifyServer" then
		sAction="SaveModifyServer":SubmitValue="修 改"
		set rs=Cl.Execute("select * from Cl_Server where ServerID=" & ServerID)
		if rs.bof and rs.eof then
			rs.close : Set Rs=Nothing
			Cl.ShowErr("<br /><li>找不到指定的记录!</li>")
		end if
		ServerName	= rs("ServerName")	: ServerAddress	= rs("ServerAddress")
		DownGroup	= rs("DownGroup")	: DownPoint		= rs("DownPoint")
		DownMoney	= rs("DownMoney")	: IsDisabled	= rs("IsDisabled")
		ReadMe	= rs("ReadMe")
		rs.close : set rs = Nothing
	else
		sAction = "SaveAddServer"		: SubmitValue = "添 加"
		ServerName	= ""		: ServerAddress	= ""
		DownGroup	= "1,2,3,4"	: DownPoint		= 0
		DownMoney	= 0			: IsDisabled	= False
		ReadMe=""
	end if
%>
<br />
<script language="JavaScript" type="text/javascript">
function CheckForm()
{
	if (document.form1.ServerName.value == "") {
		alert("请输入服务器名称!");
		document.form1.ServerName.focus();
		return false;
	}
	if (document.form1.ServerAddress.value == "") {
		alert("请输入服务器地址!");
		document.form1.ServerAddress.focus();
		return false;
	}

⌨️ 快捷键说明

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