?? admin_server.asp
字號(hào):
Response.Write " <td height=30 class=""TableRow1""><U>使用下載服務(wù)器的權(quán)限</U></td>" & vbNewLine
Response.Write " <td class=""TableRow1"">"
Response.Write " <select name=""UserGroup"">" & vbNewLine
Set RsObj = Newasp.Execute("SELECT GroupName,Grades FROM NC_UserGroup ORDER BY Groupid")
Do While Not RsObj.EOF
Response.Write Chr(9) & Chr(9) & "<option value=""" & RsObj("Grades") & """"
If Rs_e("UserGroup") = RsObj("Grades") Then Response.Write " selected"
Response.Write ">"
Response.Write RsObj("GroupName")
Response.Write "</option>" & vbCrLf
RsObj.MoveNext
Loop
Set RsObj = Nothing
Response.Write " </select> </td>" & vbNewLine
Response.Write " </tr>" & vbNewLine
Response.Write " <tr>" & vbNewLine
Response.Write " <td height=24 class=""TableRow1""><U>下載所需點(diǎn)數(shù)</U></td>" & vbNewLine
Response.Write " <td class=""TableRow1"">" & vbNewLine
Response.Write " <input type=""text"" name=""DownPoint"" size=""10"" onkeyup=if(isNaN(this.value))this.value='' value='"
Response.Write Rs_e("DownPoint")
Response.Write "'>" & vbNewLine
Response.Write "</td>" & vbNewLine
Response.Write "</tr>" & vbNewLine
Response.Write " <tr>" & vbNewLine
Response.Write " <td height=30 class=""TableRow1""><U>是否直接顯示下載地址</U></td>" & vbNewLine
Response.Write " <td class=""TableRow1"">"
Response.Write " <input type=radio name=isDisp value=""0"""
If Rs_e("IsDisp") = 0 Then Response.Write " checked"
Response.Write "> 否 "
Response.Write " <input type=radio name=isDisp value=""1"""
If Rs_e("IsDisp") = 1 Then Response.Write " checked"
Response.Write "> 是"
Response.Write " </td>" & vbNewLine
Response.Write " </tr>" & vbNewLine
Response.Write " <tr>" & vbNewLine
Response.Write " <td class=""TableRow1""height=24> </td>" & vbNewLine
Response.Write " <td class=""TableRow1"">" & vbNewLine
Response.Write " <input type=""submit"" name=""Submit"" class=button value=""保存修改"">" & vbNewLine
Response.Write " </td>" & vbNewLine
Response.Write " </tr>" & vbNewLine
Response.Write " </table>" & vbNewLine
Response.Write "</form>" & vbNewLine
Set Rs_e = Nothing
End Sub
'================================================
'過程名:savenew
'作 用:保存新的服務(wù)器
'================================================
Sub savenew()
Dim downid,rootid,ParentID
Dim depth,orders,Maxrootid
Dim strParent,neworders
Dim DownloadPath,Server_Url
On Error Resume Next
'保存添加服務(wù)器信息
If Request.Form("DownloadName") = "" Then
ErrMsg = ErrMsg + "<br>" + "<li>請(qǐng)輸入服務(wù)器名稱。"
FoundErr = True
Exit Sub
End If
If Request.Form("servers") = "" Then
ErrMsg = ErrMsg + "<br>" + "<li>請(qǐng)選擇服務(wù)器。"
FoundErr = True
Exit Sub
End If
If Request.Form("DownloadPath") = "" Then
ErrMsg = ErrMsg + "<br>" + "<li>服務(wù)器路徑不能為空。"
FoundErr = True
Exit Sub
End If
Server_Url = Replace(Request.Form("DownloadPath"), "\", "/")
If Right(Server_Url, 1) <> "/" Then
DownloadPath = Server_Url
Else
DownloadPath = Server_Url
End If
Set Rs = CreateObject("adodb.recordset")
If Request.Form("servers") <> "0" Then
SQL = "SELECT rootid,downid,depth,orders,strparent FROM NC_DownServer WHERE downid=" & Request("servers")
Rs.Open SQL, Conn, 1, 1
rootid = Rs(0)
ParentID = Rs(1)
depth = Rs(2)
orders = Rs(3)
If depth + 1 > 2 Then
ErrMsg = "<li>本系統(tǒng)限制最多只能有2級(jí)子服務(wù)器</li>"
FoundErr = True
Exit Sub
End If
strParent = Rs(4)
Rs.Close
neworders = orders
SQL = "SELECT MAX(orders) FROM NC_DownServer WHERE ParentID=" & Request("servers")
Rs.Open SQL, Conn, 1, 1
If Not (Rs.EOF And Rs.BOF) Then
neworders = Rs(0)
End If
If IsNull(neworders) Then neworders = orders
Rs.Close
Newasp.Execute ("UPDATE NC_DownServer SET orders=orders+1 WHERE orders>" & CInt(neworders) & "")
Else
SQL = "SELECT MAX(rootid) FROM NC_DownServer"
Rs.Open SQL, Conn, 1, 1
If Rs.BOF And Rs.EOF Then
Maxrootid = 1
Else
Maxrootid = Rs(0) + 1
End If
If IsNull(Maxrootid) Then Maxrootid = 1
Rs.Close
End If
If Maxrootid = 0 Then Maxrootid = 1
SQL = "SELECT downid FROM NC_DownServer WHERE downid=" & Request("newdownid")
Rs.Open SQL, Conn, 1, 1
If Not (Rs.EOF And Rs.BOF) Then
ErrMsg = "<li>您不能指定和別的服務(wù)器一樣的序號(hào)。</li>"
FoundErr = True
Exit Sub
Else
downid = CLng(Request("newdownid"))
End If
Rs.Close
SQL = "SELECT * FROM NC_DownServer"
Rs.Open SQL, Conn, 1, 3
Rs.AddNew
If Request("servers") <> "0" Then
Rs("depth") = depth + 1
Rs("rootid") = rootid
Rs("orders") = neworders + 1
Rs("parentid") = Request.Form("servers")
If strParent = "0" Then
Rs("strparent") = Request.Form("servers")
Else
Rs("strparent") = strParent & "," & Request.Form("servers")
End If
Else
Rs("depth") = 0
Rs("rootid") = Maxrootid
Rs("orders") = 0
Rs("parentid") = 0
Rs("strparent") = 0
End If
Rs("child") = 0
Rs("downid") = Request.Form("newdownid")
Rs("DownloadName") = Replace(Newasp.ChkFormStr(Request.Form("DownloadName")), "|", "")
Rs("DownloadPath") = Replace(DownloadPath, "|", "")
Rs("isDisp") = Request.Form("isDisp")
Rs("UserGroup") = Request.Form("UserGroup")
Rs("ChannelID") = Request.Form("ChannelID")
Rs("DownPoint") = CLng(Request.Form("DownPoint"))
Rs("isLock") = 0
Rs.Update
Rs.Close
If Request("servers") <> "0" Then
If depth > 0 Then Newasp.Execute ("update NC_DownServer set child=child+1 where downid in (" & strParent & ")")
Newasp.Execute ("update NC_DownServer set child=child+1 where downid=" & Request("servers"))
End If
SucMsg = "<li>服務(wù)器添加成功!</li>"
Succeed (SucMsg)
Set Rs = Nothing
End Sub
'================================================
'過程名:saveedit
'作 用:保存編輯
'================================================
Sub saveedit()
Dim newdownid,Maxrootid,ParentID
Dim depth,Child,strParent,rootid
Dim iparentid,istrparent
Dim trs,brs,mrs,k
Dim nstrparent,mstrparent,ParentSql
Dim boardcount,DownloadPath,Server_Url
On Error Resume Next
If CLng(Request("editid")) = CLng(Request("servers")) Then
ErrMsg = "<li>所屬服務(wù)器不能指定自己</li>"
ReturnError (ErrMsg)
Exit Sub
End If
Server_Url = Replace(Request.Form("DownloadPath"), "\", "/")
If Right(Server_Url, 1) <> "/" Then
DownloadPath = Server_Url
Else
DownloadPath = Server_Url
End If
Set Rs = CreateObject("adodb.recordset")
SQL = "SELECT * FROM NC_DownServer WHERE downid=" & CLng(Request("editid"))
Rs.Open SQL, Conn, 1, 3
newdownid = Rs("downid")
ParentID = Rs("parentid")
iparentid = Rs("parentid")
strParent = Rs("strparent")
depth = Rs("depth")
Child = Rs("child")
rootid = Rs("rootid")
If ParentID = 0 Then
If CLng(Request("servers")) <> 0 Then
Set trs = Newasp.Execute("select rootid from NC_DownServer where downid=" & Request("servers"))
If rootid = trs(0) Then
ErrMsg = "<li>您不能指定該服務(wù)器的下屬服務(wù)器作為所屬服務(wù)器</li>"
FoundErr = True
Exit Sub
End If
End If
Else
Set trs = Newasp.Execute("select downid from NC_DownServer where strparent like '%" & strParent & "%' and downid=" & Request("servers"))
If Not (trs.EOF And trs.BOF) Then
ErrMsg = "<li>您不能指定該服務(wù)器的下屬服務(wù)器作為所屬服務(wù)器</li>"
FoundErr = True
Exit Sub
End If
End If
If ParentID = 0 Then
ParentID = Rs("downid")
iparentid = 0
End If
Rs("DownloadName") = Replace(Newasp.ChkFormStr(Request.Form("DownloadName")), "|", "")
Rs("DownloadPath") = Replace(DownloadPath, "|", "")
Rs("isDisp") = Request.Form("isDisp")
Rs("UserGroup") = Request.Form("UserGroup")
Rs("ChannelID") = Request.Form("ChannelID")
Rs("DownPoint") = Newasp.CheckNumeric(Request.Form("DownPoint"))
Rs("isLock") = 0
Rs.Update
Rs.Close
Set Rs = Nothing
Set mrs = Newasp.Execute("select max(rootid) from NC_DownServer")
Maxrootid = mrs(0) + 1
If CLng(ParentID) <> CLng(Request("servers")) And Not (iparentid = 0 And CInt(Request("servers")) = 0) Then
If iparentid > 0 And CInt(Request("servers")) = 0 Then
Newasp.Execute ("update NC_DownServer set depth=0,orders=0,rootid=" & Maxrootid & ",parentid=0,strparent='0' where downid=" & newdownid)
strParent = strParent & ","
Set Rs = Newasp.Execute("select count(*) from NC_DownServer where strparent like '%" & strParent & "%'")
boardcount = Rs(0)
If IsNull(boardcount) Then
boardcount = 1
Else
boardcount = boardcount + 1
End If
Newasp.Execute ("update NC_DownServer set child=child-" & boardcount & " where downid=" & iparentid)
For i = 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-" & boardcount & " where downid=" & iparentid)
End If
Next
If Child > 0 Then
i = 0
Set Rs = Newasp.Execute("select * from NC_DownServer where strparent like '%" & strParent & "%'")
Do While Not Rs.EOF
i = i + 1
mstrparent = Replace(Rs("strparent"), strParent, "")
Newasp.Execute ("update NC_DownServer set depth=depth-" & depth & ",rootid=" & Maxrootid & ",strparent='" & mstrparent & "' where downid=" & Rs("downid"))
Rs.MoveNext
Loop
End If
ElseIf iparentid > 0 And CInt(Request("servers")) > 0 Then
Set trs = Newasp.Execute("select * from NC_DownServer where downid=" & Request("servers"))
strParent = strParent & ","
Set Rs = Newasp.Execute("select count(*) from NC_DownServer where strparent like '%" & strParent & "%'")
boardcount = Rs(0)
If IsNull(boardcount) Then boardcount = 1
Newasp.Execute ("update NC_DownServer set orders=orders + " & boardcount & " + 1 where rootid=" & trs("rootid") & " and orders>" & trs("orders") & "")
Newasp.Execute ("update NC_DownServer set depth=" & trs("depth") & "+1,orders=" & trs("orders") & "+1,rootid=" & trs("rootid") & ",ParentID=" & Request("servers") & ",strparent='" & trs("strparent") & "," & trs("downid") & "' where downid=" & newdownid)
i = 1
SQL = "select * from NC_DownServer where strparent like '%" & strParent & "%' order by orders"
Set Rs = Newasp.Execute(SQL)
Do While Not Rs.EOF
i = i + 1
istrparent = trs("strparent") & "," & trs("downid") & "," & Replace(Rs("strparent"), strParent, "")
Newasp.Execute ("update NC_DownServer set depth=depth+" & trs("depth") & "-" & depth & "+1,orders=" & trs("orders") & "+" & i & ",rootid=" & trs("rootid") & ",strparent='" & istrparent & "' where downid=" & Rs("downid"))
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
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -