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

📄 admin_menu.asp

📁 后台登陆admin.asp
💻 ASP
字号:
<!--#include file="mdb.asp"-->
<%Admin="System"%>
<!--#include file="check.asp"-->
<!--#include file="inc/config.asp"-->
<HTML><HEAD><TITLE>管理中心—导航管理</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<LINK href="inc/admin.css" type=text/css rel=StyleSheet>
<META content="MSHTML 6.00.2800.1126" name=GENERATOR>
</HEAD>
<%

'****************************************************
if session("adminlogin")<>sessionvar then
  Response.Write("<script language=javascript>alert('你尚未登录,或者超时了!请重新登录');this.top.location.href='admin.asp';</script>")
  response.end
end if
If request.QueryString("action")="hx66" then
	info = request.QueryString("info")
	call hx66()
End if

Sub hx66()
	Response.Write"<table width='98%' align='center' border='1' cellspacing='0' cellpadding='4' class=Hxcmsbk style='border-collapse: collapse'>"
	Response.Write"<tr align=center bordercolor='#FFFFFF'>"
	Response.Write"<td width=""100%"" class=""Hxcmsss"" colspan=2>"
	Response.Write Encode(info)
	Response.Write"</td></tr>"
	Response.Write"<tr bordercolor='#FFFFFF'>"
	Response.Write"<td valign=middle colspan=2 align=center><a href="&Request.ServerVariables("HTTP_REFERER")&" ><<返回上一页>></a></td></tr>"
	Response.Write"</table>"
End Sub

Function Encode(content)
	dim tmp
	tmp = content
	tmp = replace(tmp,"<script>","&lt;script&gt;")
	tmp = replace(tmp,"</script>","&lt;/script&gt;")
	tmp = replace(tmp,"<iframe>","&lt;iframe&gt;")
	tmp = replace(tmp,"</iframe>","&lt;/iframe&gt;")
	tmp = replace(tmp,"<meta","&lt;meta")
	Encode = tmp
End Function

select case request.QueryString("action")
	case ""
		call Main()
	case "adminmenu"
		call Adminmenu()
	case "save"
		call SaveSet()
	case "edit"
		call Edit()
	case "del"
		call del()
end Select

Sub del()
	id = request.QueryString("id")
	conn.Execute("Delete from menu where id ="&id)
	info="<li> 删除菜单项目成功"
	response.Redirect("admin_menu.asp?action=hx66&info="&info&"")	
	SaveSet.close
End sub
Sub Edit()
	dim j,i,id
	j = request.Form("i")
	j = Split(j,",")(Ubound(Split(j,",")))
	for i = 1 to j
		order = request.Form("txt_order("&i&")")
		menu_name=request.Form("txt_Name("&i&")")
		menu_title=request.Form("txt_title("&i&")")
		menu_URL=request.Form("txt_url("&i&")")
		target = request.Form("sel_target("&i&")")
		items=request.Form("sel_type("&i&")")
		id = request.Form("id("&i&")")
		shown = request.Form("sel_show("&i&")")
		conn.Execute ("Update menu set name='"&menu_name&"',title='"&menu_title&"',url='"&menu_URL&"',target='"&target&"',items="&items&",order_num="&order&",shown="&shown&" where id ="&id)
	next
	info="<li> 批量修改菜单项目成功"
	response.Redirect("admin_menu.asp?action=hx66&info="&info&"")	
	SaveSet.close
End sub

Sub Saveset()
	sql = "Select top 1 * from menu order by order_num desc"
	set rs = conn.Execute (sql)
	if rs.eof then
		order = 1
	else
		order = rs(6)+1
	end if
	rs.close
	menu_name=request.Form("txt_text")
	menu_URL=request.Form("txt_url")
	target = request.Form("sel_target")
	title=request.Form("txt_title")
	items=request.Form("sel_type")
	conn.Execute ("insert into menu(name,url,target,title,items,order_num,shown) Values('"&menu_name&"','"&menu_URL&"','"&target&"','"&title&"',"&items&","&order&",true)")
	info="<li> 菜单项目添加成功"
	response.Redirect("admin_menu.asp?action=hx66&info="&info&"")	
	SaveSet.close
End Sub

sub Main()
%>
<table width="98%" align="center" border="1" cellspacing="0" cellpadding="4" class=Hxcmsbk style="border-collapse: collapse">
<form action="admin_menu.asp?action=save" method="post">
<tr><td class=Hxcmsss align="center" colspan="2">网站菜单添加</td></tr>
  <tr class=Hxcmsqs>
    <td colspan="2" align="center">&nbsp;设置导航菜单,显示于网站上方。</td>
  </tr>
  <tr class=Hxcmsds>
    <td width="17%">&nbsp;名称</td>
    <td width="83%"><input name="txt_text" type="text" id="txt_text" class="lostfocus" gf="0" onmouseover='this.className="getfocus"' onmouseout='if (this.gf=="0") this.className="lostfocus"' onblur='this.className="lostfocus";this.gf="0"' onfocus='this.className="getfocus";this.gf="1"'></td>
  </tr>
  <tr class=Hxcmsds>
    <td>&nbsp;连接地址</td>
    <td><input name="txt_url" type="text" id="txt_url" size="40" class="lostfocus" gf="0" onmouseover='this.className="getfocus"' onmouseout='if (this.gf=="0") this.className="lostfocus"' onblur='this.className="lostfocus";this.gf="0"' onfocus='this.className="getfocus";this.gf="1"'>&nbsp;&nbsp;目标窗口:      
      <select name="sel_target" id="sel_target">
        <option value="_self">当前窗口</option>
        <option value="_blank">新窗口</option>
      </select></td>
  </tr>
  <tr class=Hxcmsds>
    <td>&nbsp;注释</td>
    <td><input name="txt_title" type="text" id="txt_title" size="40" class="lostfocus" gf="0" onmouseover='this.className="getfocus"' onmouseout='if (this.gf=="0") this.className="lostfocus"' onblur='this.className="lostfocus";this.gf="0"' onfocus='this.className="getfocus";this.gf="1"'></td>
  </tr>
  <tr class=Hxcmsds>
    <td>&nbsp;分类</td>
    <td><select name="sel_type" id="sel_type">
          <option value="0" selected>一级分类</option>
		  <%Set rs_item = conn.Execute("Select * from menu where items=0")
		  do while not rs_item.eof%>
		  	<option value="<%=rs_item(0)%>"><%=rs_item(1)%></option>
		  <%rs_item.movenext
		  loop
		  rs_item.close%>
        </select></td>
  </tr>
  <tr class=Hxcmsqs>
    <td colspan="2"><div align="center">
      <input type="submit" name="Submit" value="提交">
    </div></td>
    </tr>
</form>
</table>
<%End Sub

Sub Adminmenu()%>
<table width="98%" align="center" border="1" cellspacing="0" cellpadding="4" class=Hxcmsbk style="border-collapse: collapse">
   <form action="admin_menu.asp?action=edit" method="post">
    <tr>
      <td colspan="8" class=Hxcmsss><div align="center"><span style="font-weight: bold">导航菜单批量修改</span></div></td>
    </tr>
    <tr class=Hxcmsqs>
      <td width="4%"><div align="center">排序</div></td>
      <td width="12%">&nbsp;菜单名称</td>
      <td width="15%">&nbsp;菜单注释</td>
      <td width="30%">&nbsp;菜单连接</td>
      <td width="11%"><div align="center">目标窗口</div></td>
      <td width="10%"><div align="center">级别</div></td>
      <td width="8%"><div align="center">显示</div></td>
      <td width="10%"><div align="center">操作</div></td>
    </tr>
	<%Set rs = conn.Execute("Select * from menu order by order_num")
	if rs.eof then
		response.Write("<tr><td colspan=5><center>暂时没有任何菜单项目</center></td></tr>")
	end if
	dim i,j
	i = 0
	j = 1
	do while not rs.eof
	id = rs(0)
	i = i+1%>
    <tr class=Hxcmsds>
      <td><div align="center">
        <input name="txt_order(<%=i%>)" type="text" id="txt_order(<%=i%>)" value="<%if rs(5)=0 then response.Write j:j=j+1:else:response.Write(0):j=j%>" size="4" maxlength="2" <%if rs(5)<>0 then response.Write("readonly")%> class="lostfocus" gf="0" onmouseover='this.className="getfocus"' onmouseout='if (this.gf=="0") this.className="lostfocus"' onblur='this.className="lostfocus";this.gf="0"' onfocus='this.className="getfocus";this.gf="1"'>
      </div></td>
      <td><input name="txt_Name(<%=i%>)" type="text" id="txt_Name(<%=i%>)" value="<%=rs(1)%>" size="12" gf="0" onmouseover='this.className="getfocus"' onmouseout='if (this.gf=="0") this.className="lostfocus"' onblur='this.className="lostfocus";this.gf="0"' onfocus='this.className="getfocus";this.gf="1"'></td>
      <td>
<input name="txt_title(<%=i%>)" type="text" id="txt_title(<%=i%>)" value="<%=rs(4)%>" size="15" gf="0" onmouseover='this.className="getfocus"' onmouseout='if (this.gf=="0") this.className="lostfocus"' onblur='this.className="lostfocus";this.gf="0"' onfocus='this.className="getfocus";this.gf="1"'></td>
      <td>
      <input name="txt_URL(<%=i%>)" type="text" id="txt_URL(<%=i%>)" value="<%=rs(2)%>" size="30" gf="0" onmouseover='this.className="getfocus"' onmouseout='if (this.gf=="0") this.className="lostfocus"' onblur='this.className="lostfocus";this.gf="0"' onfocus='this.className="getfocus";this.gf="1"'>
      <input name="i" type="hidden" id="i" value=<%=i%>>
      <input name="id(<%=i%>)" type="hidden" id="id" value="<%=id%>"></td>
      <td><div align="center">
        <select name="sel_target(<%=i%>)" id="sel_target">
            <option value="_self" <%if rs(3) = "_self" then response.Write("selected")%>>当前窗口</option>
            <option value="_blank" <%if rs(3) = "_blank" then response.Write("selected")%>>新窗口</option>
        </select>
      </div></td>
      <td><div align="center">
        <select name="sel_type(<%=i%>)" id="sel_type(<%=i%>)" <%if rs(7) = true then response.Write " style='display:none'"%>>
          <option value="0" <%if rs(5)=0 then response.Write("selected")%>>一级分类</option>
		  <%Set rs_item = conn.Execute("Select * from menu where items=0")
		  do while not rs_item.eof%>
		  	<option value="<%=rs_item(0)%>" <%if rs(5)=rs_item(0) then response.Write("selected")%>><%=rs_item(1)%></option>
		  <%rs_item.movenext
		  loop
		  rs_item.close%>
        </select>
      </div></td>
      <td><div align="center">
        <select name="sel_show(<%=i%>)" id="sel_show(<%=i%>)">
          <option value="true">显示</option>
            <option value="false" <%if rs(8) = false then response.Write("selected")%>>隐藏</option>
        </select>
      </div></td>
      <td class="table"><div align="center">
      <%if rs(7) = true then
	  	 response.Write("<font color=blue title='系统项目,不能删除'>系统项目</font>")
	   else%>
	  <a href="admin_menu.asp?action=del&id=<%=id%>" onClick="{if(confirm('您确定要删除此项目吗?')){return true;}return false;}">删除</a>
	  <%End if%>
	  </div></td>
    </tr>
	<%
	rs.movenext
	loop
	rs.close
	%>
    <tr class=Hxcmsds>
      <td colspan="8">&nbsp;<font color="#FF0000"><b>注意:</b>只能修改<一级分类>的顺序。非一级分类的排序均设为0。</font></td>
     </tr>
    <tr class=Hxcmsqs>
      <td colspan="8"><div align="center">
        <input type="submit" name="Submit" value="提 交" class="button">
      </div></td>
    </tr>
  </form>
</table>
<%End Sub

'****************************************************
%>

⌨️ 快捷键说明

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