📄 admin_server.asp
字号:
Rs.MoveNext
Loop
ParentID = Request("servers")
If rootid = trs("rootid") Then
Newasp.Execute ("update NC_DownServer set child=child+" & i & " where (not ParentID=0) and downid=" & ParentID)
For k = 1 To trs("depth")
Set Rs = Newasp.Execute("select parentid from NC_DownServer where (not ParentID=0) and downid=" & ParentID)
If Not (Rs.EOF And Rs.BOF) Then
ParentID = Rs(0)
Newasp.Execute ("update NC_DownServer set child=child+" & i & " where (not ParentID=0) and downid=" & ParentID)
End If
Next
Newasp.Execute ("update NC_DownServer set child=child-" & i & " where (not ParentID=0) and downid=" & iparentid)
For k = 1 To depth
Set Rs = Newasp.Execute("select parentid from NC_DownServer where (not ParentID=0) and downid=" & iparentid)
If Not (Rs.EOF And Rs.BOF) Then
iparentid = Rs(0)
Newasp.Execute ("update NC_DownServer set child=child-" & i & " where (not ParentID=0) and downid=" & iparentid)
End If
Next
Else
Newasp.Execute ("update NC_DownServer set child=child+" & i & " where downid=" & ParentID)
For k = 1 To trs("depth")
Set Rs = Newasp.Execute("select parentid from NC_DownServer where downid=" & ParentID)
If Not (Rs.EOF And Rs.BOF) Then
ParentID = Rs(0)
Newasp.Execute ("update NC_DownServer set child=child+" & i & " where downid=" & ParentID)
End If
Next
Newasp.Execute ("update NC_DownServer set child=child-" & i & " where downid=" & iparentid)
For k = 1 To depth
Set Rs = Newasp.Execute("select parentid from NC_DownServer where downid=" & iparentid)
If Not (Rs.EOF And Rs.BOF) Then
iparentid = Rs(0)
Newasp.Execute ("update NC_DownServer set child=child-" & i & " where downid=" & iparentid)
End If
Next
End If
Else
Set trs = Newasp.Execute("select * from NC_DownServer where downid=" & Request("servers"))
Set Rs = Newasp.Execute("select count(*) from NC_DownServer where rootid=" & rootid)
boardcount = Rs(0)
ParentID = Request("servers")
Newasp.Execute ("update NC_DownServer set child=child+" & boardcount & " where downid=" & ParentID)
For k = 1 To trs("depth")
Set Rs = Newasp.Execute("select parentid from NC_DownServer where downid=" & ParentID)
If Not (Rs.EOF And Rs.BOF) Then
ParentID = Rs(0)
Newasp.Execute ("update NC_DownServer set child=child+" & boardcount & " where downid=" & ParentID)
End If
Next
Newasp.Execute ("update NC_DownServer set orders=orders + " & boardcount & " + 1 where rootid=" & trs("rootid") & " and orders>" & trs("orders") & "")
i = 0
SQL = "select * from NC_DownServer where rootid=" & rootid & " order by orders"
Set Rs = Newasp.Execute(SQL)
Do While Not Rs.EOF
i = i + 1
If Rs("parentid") = 0 Then
If trs("strparent") = "0" Then
strParent = trs("downid")
Else
strParent = trs("strparent") & "," & trs("downid")
End If
Newasp.Execute ("update NC_DownServer set depth=depth+" & trs("depth") & "+1,orders=" & trs("orders") & "+" & i & ",rootid=" & trs("rootid") & ",strparent='" & strParent & "',parentid=" & Request("servers") & " where downid=" & Rs("downid"))
Else
If trs("strparent") = "0" Then
strParent = trs("downid") & "," & Rs("strparent")
Else
strParent = trs("strparent") & "," & trs("downid") & "," & Rs("strparent")
End If
Newasp.Execute ("update NC_DownServer set depth=depth+" & trs("depth") & "+1,orders=" & trs("orders") & "+" & i & ",rootid=" & trs("rootid") & ",strparent='" & strParent & "' where downid=" & Rs("downid"))
End If
Rs.MoveNext
Loop
End If
End If
SucMsg = "<li>服务器修改成功!</li>"
Succeed (SucMsg)
Set Rs = Nothing
Set mrs = Nothing
Set trs = Nothing
End Sub
'================================================
'过程名:DelDownPath
'作 用:删除服务器
'================================================
Sub DelDownPath()
Dim rsUsage
On Error Resume Next
Set Rs = Newasp.Execute("select strparent,child,depth,rootid from NC_DownServer where downid=" & Request("editid"))
If Not (Rs.EOF And Rs.BOF) Then
If Rs(1) > 0 Then
ErrMsg = "该服务器含有下载路径,请删除其下载路径后再进行删除本服务器的操作"
FoundErr = True
Exit Sub
End If
If Rs("depth") = 0 Then
Set rsUsage = Newasp.Execute("SELECT downid FROM NC_DownAddress WHERE downid=" & Rs("rootid"))
If Not (rsUsage.EOF And rsUsage.BOF) Then
ErrMsg = "该下载服务器正在使用中,不能删除!"
FoundErr = True
Exit Sub
End If
Set rsUsage = Nothing
End If
If Rs(2) > 0 Then
Newasp.Execute ("UPDATE NC_DownServer SET child=child-1 WHERE downid in (" & Rs(0) & ")")
End If
SQL = "DELETE FROM NC_DownServer WHERE downid=" & Request("editid")
Newasp.Execute (SQL)
End If
Set Rs = Nothing
Succeed ("服务器删除成功!")
End Sub
'================================================
'过程名:isLock
'作 用:锁定服务器
'================================================
Sub isLock()
Newasp.Execute ("update NC_DownServer set isLock = 1 where downid in (" & Request("editid") & ")")
Response.Redirect (Request.ServerVariables("HTTP_REFERER"))
End Sub
'================================================
'过程名:FreeLock
'作 用:解除服务器锁定
'================================================
Sub FreeLock()
Newasp.Execute ("update NC_DownServer set isLock = 0 where downid in (" & Request("editid") & ")")
Response.Redirect (Request.ServerVariables("HTTP_REFERER"))
End Sub
'================================================
'过程名:serverorders
'作 用:服务器排序
'================================================
Sub serverorders()
Dim trs
Dim uporders
Dim doorders
Response.Write " <table width=""96%"" border=""0"" cellspacing=""1"" cellpadding=""2"" class=""tableBorder"" align=center>" & vbNewLine
Response.Write " <tr>" & vbNewLine
Response.Write " <th colspan=2>服务器路径重新排序修改(请在相应服务器的排序表单内输入相应的排列序号)" & vbNewLine
Response.Write " </th>" & vbNewLine
Response.Write " </tr>" & vbNewLine
Set Rs = CreateObject("Adodb.recordset")
SQL = "SELECT * FROM NC_DownServer WHERE ChannelID=" & ChannelID & " ORDER BY RootID,orders"
Rs.Open SQL, Conn, 1, 1
If Rs.BOF And Rs.EOF Then
Response.Write "还没有相应的服务器。"
Else
Do While Not Rs.EOF
Response.Write "<form action=admin_server.asp?action=updateorders method=post><tr><td width=""50%"" class=TableRow1>"
If Rs("depth") = 1 Then Response.Write " <font color=""#666666"">├</font>"
If Rs("depth") > 1 Then
For i = 2 To Rs("depth")
Response.Write " <font color=""#666666"">│</font>"
Next
Response.Write " <font color=""#666666"">├</font> "
End If
If Rs("parentid") = 0 Then Response.Write ("<b>")
Response.Write Rs("DownloadName")
If Rs("child") > 0 Then Response.Write "(" & Rs("child") & ")"
Response.Write "</td><td width=""50%"" class=TableRow1>"
If Rs("ParentID") > 0 Then
Set trs = Newasp.Execute("SELECT COUNT(*) FROM NC_DownServer WHERE ParentID=" & Rs("ParentID") & " and orders<" & Rs("orders") & "")
uporders = trs(0)
If IsNull(uporders) Then uporders = 0
Set trs = Newasp.Execute("SELECT COUNT(*) FROM NC_DownServer WHERE ParentID=" & Rs("ParentID") & " and orders>" & Rs("orders") & "")
doorders = trs(0)
If IsNull(doorders) Then doorders = 0
If uporders > 0 Then
Response.Write "<select name=uporders size=1><option value=0>↑</option>"
For i = 1 To uporders
Response.Write "<option value=" & i & ">↑" & i & "</option>"
Next
Response.Write "</select>"
End If
If doorders > 0 Then
If uporders > 0 Then Response.Write " "
Response.Write "<select name=doorders size=1><option value=0>↓</option>"
For i = 1 To doorders
Response.Write "<option value=" & i & ">↓" & i & "</option>"
Next
Response.Write "</select>"
End If
If doorders > 0 Or uporders > 0 Then
Response.Write vbNewLine & "<input type=""hidden"" name=ChannelID value="""
Response.Write ChannelID
Response.Write """>" & vbNewLine
Response.Write "<input type=hidden name=""editID"" value=""" & Rs("downid") & """> <input type=submit name=Submit class=button value='修 改'>"
End If
End If
Response.Write "</td></tr></form>"
uporders = 0
doorders = 0
Rs.MoveNext
Loop
End If
Rs.Close
Set Rs = Nothing
Response.Write "</table>" & vbNewLine
End Sub
'================================================
'过程名:updateorders
'作 用:更新服务器排序
'================================================
Sub updateorders()
Dim ParentID
Dim orders
Dim strParent
Dim Child
Dim uporders
Dim doorders
Dim oldorders
Dim trs
Dim ii
If Not IsNumeric(Request("editID")) Then
ReturnError ("非法的参数!")
Exit Sub
End If
If Request("uporders") <> "" And Not CInt(Request("uporders")) = 0 Then
If Not IsNumeric(Request("uporders")) Then
ReturnError ("非法的参数!")
Exit Sub
ElseIf CInt(Request("uporders")) = 0 Then
ReturnError ("请选择要提升的数字!")
Exit Sub
End If
Set Rs = Newasp.Execute("SELECT ParentID,orders,strparent,child FROM NC_DownServer where downid=" & Request("editID"))
ParentID = Rs(0)
orders = Rs(1)
strParent = Rs(2) & "," & Request("editID")
Child = Rs(3)
i = 0
If Child > 0 Then
Set Rs = Newasp.Execute("SELECT COUNT(*) FROM NC_DownServer WHERE strparent like '%" & strParent & "%'")
oldorders = Rs(0)
Else
oldorders = 0
End If
Set Rs = Newasp.Execute("SELECT downid,orders,child,strparent FROM NC_DownServer WHERE ParentID=" & ParentID & " and orders<" & orders & " order by orders desc")
Do While Not Rs.EOF
i = i + 1
If CInt(Request("uporders")) >= i Then
If Rs(2) > 0 Then
ii = 0
Set trs = Newasp.Execute("select downid,orders from NC_DownServer where strparent like '%" & Rs(3) & "," & Rs(0) & "%' order by orders")
If Not (trs.EOF And trs.BOF) Then
Do While Not trs.EOF
ii = ii + 1
Newasp.Execute ("update NC_DownServer set orders=" & orders & "+" & oldorders & "+" & ii & " where downid=" & trs(0))
trs.MoveNext
Loop
End If
End If
Newasp.Execute ("update NC_DownServer set orders=" & orders & "+" & oldorders & " where downid=" & Rs(0))
If CInt(Request("uporders")) = i Then uporders = Rs(1)
End If
orders = Rs(1)
Rs.MoveNext
Loop
Newasp.Execute ("update NC_DownServer set orders=" & uporders & " where downid=" & Request("editID"))
If Child > 0 Then
i = uporders
Set Rs = Newasp.Execute("select downid from NC_DownServer where strparent like '%" & strParent & "%' order by orders")
Do While Not Rs.EOF
i = i + 1
Newasp.Execute ("update NC_DownServer set orders=" & i & " where downid=" & Rs(0))
Rs.MoveNext
Loop
End If
Set Rs = Nothing
Set trs = Nothing
ElseIf Request("doorders") <> "" Then
If Not IsNumeric(Request("doorders")) Then
ReturnError ("非法的参数!")
Exit Sub
ElseIf CInt(Request("doorders")) = 0 Then
ReturnError ("请选择要下降的数字!")
Exit Sub
End If
Set Rs = Newasp.Execute("select ParentID,orders,strparent,child from NC_DownServer where downid=" & Request("editID"))
ParentID = Rs(0)
orders = Rs(1)
strParent = Rs(2) & "," & Request("editID")
Child = Rs(3)
i = 0
If Child > 0 Then
Set Rs = Newasp.Execute("select count(*) from NC_DownServer where strparent like '%" & strParent & "%'")
oldorders = Rs(0)
Else
oldorders = 0
End If
Set Rs = Newasp.Execute("select downid,orders,child,strparent from NC_DownServer where ParentID=" & ParentID & " and orders>" & orders & " order by orders")
Do While Not Rs.EOF
i = i + 1
If CInt(Request("doorders")) >= i Then
If Rs(2) > 0 Then
ii = 0
Set trs = Newasp.Execute("select downid,orders from NC_DownServer where strparent like '%" & Rs(3) & "," & Rs(0) & "%' order by orders")
If Not (trs.EOF And trs.BOF) Then
Do While Not trs.EOF
ii = ii + 1
Newasp.Execute ("update NC_DownServer set orders=" & orders & "+" & ii & " where downid=" & trs(0))
trs.MoveNext
Loop
End If
End If
Newasp.Execute ("update NC_DownServer set orders=" & orders & " where downid=" & Rs(0))
If CInt(Request("doorders")) = i Then doorders = Rs(1)
End If
orders = Rs(1)
Rs.MoveNext
Loop
Newasp.Execute ("UPDATE NC_DownServer SET orders=" & doorders & " WHERE downid=" & Request("editID"))
If Child > 0 Then
i = doorders
Set Rs = Newasp.Execute("SELECT downid from NC_DownServer WHERE strparent like '%" & strParent & "%' ORDER BY orders")
Do While Not Rs.EOF
i = i + 1
Newasp.Execute ("UPDATE NC_DownServer SET orders=" & i & " WHERE downid=" & Rs(0))
Rs.MoveNext
Loop
End If
Set Rs = Nothing
Set trs = Nothing
End If
Response.Redirect "admin_server.asp?action=serverorders&ChannelID=" & Request("ChannelID")
End Sub
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -