📄 admin_menu.asp
字号:
<!-- #include file="Setup.asp" -->
<!-- #include file="CheckAdmin.asp" -->
<%
if RequestCookies("Userpass")="" or RequestCookies("Userpass")<>session("pass") then Response.Write ("<script>top.location.href='login.asp';</script>")
if UserRoleID <> 1 then Alert("您没有权限进入后台")
MenuID=RequestInt("MenuID")
SortNum=RequestInt("SortNum")
ParentID=RequestInt("ParentID")
Name=HTMLEncode(Request("Name"))
Url=HTMLEncode(Request("Url"))
select case Request("menu")
case ""
Show
case "add"
add
case "addok"
Rs.Open "[Wo_Menus]",Conn,1,3
Rs.addNew
Rs("name")=Name
Rs("url")=Url
Rs("ParentID")=ParentID
Rs("SortNum")=SortNum
Rs.update
Rs.close
Show
case "edit"
edit
case "editok"
editok
case "Del"
Conn.execute("Delete from [Wo_Menus] where MenuID="&MenuID&" ")
Show
end select
Sub Show
%>
群组菜单管理<br>
<form method="POST" action="?menu=addok" name=form>
<input type=hidden name=ParentID value=0>
<input type=hidden name=SortNum value=1>
<input type=hidden name=url value="#">
菜单名称:(例如:插件)<input name="name"> <input type="submit" value="添加"></form>
<table cellspacing=1 cellpadding=5 width=70% border=0 id=CommonListArea align=center>
<%Adminmenu(0)%>
</table>
<br>
<%
End Sub
Sub add
%>
<form method="POST" action="?menu=addok" name=form>
<table cellspacing="1" width="60%" border="0" id=CommonListArea align="center">
<tr id=CommonListTitle3>
<td align="center" colspan="4">添加菜单</td>
</tr>
<tr id=CommonListCell>
<td align="right" width="10%">标题:</td>
<td width="40%"><input name="name"></td>
<td align="right" width="10%">分类:</td>
<td width="40%">
<select name="ParentID">
<option value="0">一级菜单</option>
<%
sql="Select * From [Wo_Menus] where ParentID=0 order by SortNum"
Set Rs1=Conn.Execute(sql)
do while not rs1.eof
%>
<option value="<%=rs1("MenuID")%>" <%if MenuID=Rs1("MenuID") then%>selected<%end if%>><%=rs1("name")%></option>
<%
rs1.Movenext
loop
Set Rs1 = Nothing
%>
</select>
</td>
</tr>
<tr id=CommonListCell>
<td align="right" width="10%">链接:</td>
<td width="40%"><input name="url"></td>
<td align="right" width="10%">排序:</td>
<td width="40%"><input size="2" value="1" name="SortNum"> 从小到大排序</td>
</tr>
<tr id=CommonListCell>
<td align="center" width="100%" colspan="4">
<input type="submit" value=" 添 加 "> <input type="reset" value=" 重 填 ">
</td>
</tr>
</table>
<%
End Sub
Sub editok
if MenuID=Request("ParentID") then Alert("设置错误")
Rs.Open "select * from [Wo_Menus] where MenuID="&MenuID&"",Conn,1,3
Rs("name")=name
Rs("url")=url
Rs("ParentID")=ParentID
Rs("SortNum")=SortNum
Rs.update
Rs.close
Response.Write("编 辑 成 功 !")
End Sub
Sub edit
sql="Select * From [Wo_Menus] where MenuID="&MenuID&""
Set Rs=Conn.Execute(sql)
%>
<form method="POST" action="?menu=editok" name=form>
<input type=hidden name=MenuID value=<%=MenuID%>>
<table cellspacing="1" width="60%" border="0" id=CommonListArea align="center">
<tr id=CommonListTitle3>
<td align="center" colspan="4">编辑菜单</td>
</tr>
<tr id=CommonListCell>
<td align="right" width="10%">标题:</td>
<td width="40%"><input name="name" value="<%=Rs("name")%>"></td>
<td align="right" width="10%">分类:</td>
<td width="40%">
<select name="ParentID">
<option value="0">一级菜单</option>
<%
sql="Select * From [Wo_Menus] where ParentID=0 order by SortNum"
Set Rs1=Conn.Execute(sql)
do while not rs1.eof
%>
<option value="<%=rs1("MenuID")%>" <%if Rs("ParentID")=rs1("MenuID") then%>selected<%end if%>><%=rs1("name")%></option>
<%
rs1.Movenext
loop
Set Rs1 = Nothing
%>
</select>
</td>
</tr>
<tr id=CommonListCell>
<td align="right" width="10%">链接:</td>
<td width="40%"><input name="url" value="<%=Rs("Url")%>" size="20"></td>
<td align="right" width="10%">排序:</td>
<td width="40%"><input size="2" value="<%=Rs("SortNum")%>" name="SortNum"> 从小到大排序</td>
</tr>
<tr id=CommonListCell>
<td align="center" width="100%" colspan="4">
<input type="submit" value=" 编 辑 ">
<input type="reset" value=" 重 填 "></td>
</tr>
</table>
<%
End Sub
Sub Adminmenu(selec)
sql="Select * From [Wo_Menus] where ParentID="&selec&" order by SortNum"
Set Rs1=Conn.Execute(sql)
do while not rs1.eof
if rs1("ParentID")=0 then
%>
<tr id=CommonListTitle3>
<td align=center><%=rs1("name")%></td>
<td align=right width=150><a href="Admin_Menu.asp?menu=add&MenuID=<%=rs1("MenuID")%>">添加</a> | <a href=Admin_Menu.asp?menu=edit&MenuID=<%=rs1("MenuID")%>>编辑</a> | <a href=Admin_Menu.asp?menu=Del&MenuID=<%=rs1("MenuID")%>>删除</a></td>
</tr>
<%
else
response.write "<tr id=CommonListCell><td>"&rs1("name")&"(<a href="&rs1("url")&" target=_blank>"&rs1("url")&"</a>)</td><td align=right><a href=Admin_Menu.asp?menu=edit&MenuID="&rs1("MenuID")&">编辑</a> | <a href=Admin_Menu.asp?menu=Del&MenuID="&rs1("MenuID")&">删除</a></td></tr>"
end if
Adminmenu(rs1("MenuID"))
rs1.Movenext
loop
Set Rs1 = Nothing
End Sub
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -