admin_city.asp

来自「CityCN V2.1 是自主开发的基于ASP+Access的新型资讯信息系统。」· ASP 代码 · 共 150 行

ASP
150
字号
<!--#include file="config.asp" -->
<!--#include file="conn.asp" -->
<!--#include file="admin_admininfo.asp"-->
<!--#include file="sub_change.asp" -->
<!--#include file="admin_turnpage.asp" -->
<%
if session("adminname")<>adminname or session("adminpwd")<>adminpwd then
  response.Redirect("admin_login.asp")
end if

Dim RowCount,order,del,msg
RowCount = 20  '每页显示的记录条数  

order=trim(request("order"))
del=trim(request.QueryString("del"))

if del="ok" then
  dim rs_del
  set rs_del=server.CreateObject("adodb.recordset")
  rs_del.open "delete from 城市 where 编号="&trim(request.QueryString("id")),conn,3,3
  rs_del.close
  set rs_del=nothing
  messageinfo="<b>从数据库中删除成功!</b>"
end if

set rs=server.CreateObject("adodb.recordset")
select case order
  case "notype"
    msg="未审核城市"
    rs.open "select * from 城市 where 审核=0 order by 排名 asc",conn,1,1
  case "yestype"
    msg="已审核城市"
    rs.open "select * from 城市 where 审核=1 order by 排名 asc",conn,1,1
  case "pro"
    msg="<u>"&strchange(trim(request.QueryString("pro")))&"</u> 下所有城市"
    rs.open "select * from 城市 where 省份='"&strchange(trim(request.QueryString("pro")))&"' order by 排名 asc",conn,1,1
  case "tui"
    if strchange(trim(request.QueryString("num")))<>"" and IsNumeric(strchange(trim(request.QueryString("num")))) then
      msg="搜索推荐数为 <u>"&strchange(trim(request.QueryString("num")))&"</u> 城市"
      rs.open "select * from 城市 where 审核=1 and 推荐数="&strchange(trim(request.QueryString("num")))&" order by 排名 asc",conn,1,1  
    else
      msg="抱歉!无法取得推荐数,显示所有城市!"
      rs.open "select * from 城市 where 审核=1 order by 排名 asc",conn,1,1  
    end if
  case "sch_name"
    if strchange(trim(request.form("name")))<>"" and strchange(trim(request.form("ctype")))<>"" then
      msg="在 <u>"&strchange(trim(request.form("ctype")))&"</u> 搜索关键字:<u><font color='red'>" &strchange(trim(request.form("name")))&"</font></u>"
      rs.open "select * from 城市 where "&strchange(trim(request.form("ctype")))&" like '%"&strchange(trim(request.form("name")))&"%' order by 排名 asc",conn,1,1
    else
      msg="<font color='red'>关键字为空,显示所有城市</font>"
      rs.open "select * from 城市 order by 排名 asc",conn,1,1
    end if
  case else
    msg="<b>所有城市</b>"
    rs.open "select * from 城市 order by 排名 asc,人气 asc",conn,1,1
end select
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>【后台管理】城市信息管理 - <%=sitename%></title>
<link href="admin.css" rel="stylesheet" type="text/css">
<SCRIPT language='javascript' src='inc/pop.js'></SCRIPT>
<script language="VBScript">
<!--
Function isdel(id)
  dim myvar
  myvar = MsgBox (Chr(10) &"  确定要删除?      "&Chr(13) & Chr(10)& Chr(10) &"  该操作不可恢复!请慎重使用!"& Chr(10), 1+48+256, "警告")
  if myvar=1 then window.location="?del=ok&order=<%=order%>&id="&id
End Function
-->
</script>
</head>
<body leftmargin="0" topmargin="0">
<div align="center">
<!--#include file="admin_top_city.asp" -->
<br>
<table width="90%" border="1" cellpadding="0" cellspacing="0" bordercolor="#999999">
  <tr>
    <td height="40" align="center" style="line-height: 16pt"><b>城市管理</b></td>
  </tr>
</table>
<table width="90%" border="0" cellpadding="5" cellspacing="1" bgcolor="#DFEAF2">
  <tr bgcolor="#333333"> 
    <td height="20" bgcolor="#FFFFFF" colspan="2">选择:
      <a href="?">所有城市</a> ※ 
      <a href="?order=yestype">已审核城市</a>|<a href="?order=notype">未审核城市</a> ※ 
      推荐数:<a href="?order=tui&num=0">0</a>|<a href="?order=tui&num=1">1</a>|<a href="?order=tui&num=2">2</a> ※     
    </td>
  </tr>
  <tr bgcolor="#333333">
    <form method="POST" action="admin_city.asp" name="city">
    <td bgcolor="#FFFFFF">
      搜索:<input type="hidden" name="order" value="sch_name"><input type="text" name="name" size="20" value="<%=strchange(trim(request.form("name")))%>" onclick="javascript:this.focus();this.select();" >
      <select size="1" name="ctype">
		<option value="城市" <%if strchange(trim(request.form("ctype")))="城市" then response.write "selected"%>>所在城市</option>
		<option value="区号" <%if strchange(trim(request.form("ctype")))="区号" then response.write "selected"%>>城市区号</option>
		<option value="省份" <%if strchange(trim(request.form("ctype")))="省份" then response.write "selected"%>>所在省份</option>
	  </select>
	  <input type="submit" value="提交" name="submit">
    </td>
	</form>
    <td bgcolor="#FFFFFF"><%Call TurnPage(Rs,RowCount)%></td>
  </tr>
  <tr bgcolor="#333333"> 
    <td bgcolor="#FFFFFF" colspan="2" height="25"><%response.write  msg&"&nbsp;&nbsp;&nbsp;&nbsp;共有<font color='red'>"&rs.recordcount& "</font>条记录"%><%if messageinfo<>"" then response.write "<br><font color='red'>"&messageinfo&"</font>"%></td>
  </tr>
</table>
<hr color="#FF0000" width="90%">
<%Do while Not rs.eof and not rs.bof and RowCount>0 %>
<table border="1" cellpadding="3" cellspacing="0" style="border-collapse: collapse" width="90%" onMouseOver='this.style.backgroundColor="#DFEAF2"' onMouseOut='this.style.backgroundColor=""'>
  <tr>
    <td width="170" bgcolor="#DFEAF2">【<font color="red"><%=rs("编号")%></font>】<a href="admin_city_mod.asp?ct=<%=rs("城市")%>"><%=rs("城市")%></a><%if rs("审核")=0 then response.write "<a style='color:red' href='VBScript:isdel("&rs("编号")&")'>【删除】</a>"%></td>
    <td width="100"><%=rs("省份")%></td>
    <td width="100" bgcolor="#DFEAF2"><%=rs("区号")%></td>
    <td width="100">人气:<%=rs("人气")%></td>
    <td width="100" bgcolor="#DFEAF2">排名:<%=rs("排名")%></td>
    <td width="100">推荐数:<%=rs("推荐数")%></td>
  </tr>
  <tr>
    <td colspan="6">简介:<%=rs("简介")%></td>
  </tr>
  <tr>
    <td colspan="3">公告:<%=rs("公告")%></td>
    <td colspan="3" bgcolor="#DFEAF2" align="right">
      修改:<%=rs("修改")%>
      <%
      if rs("审核")=1 then
        response.write"【已审】"
	  else
	    response.write"【<font color=red>未审</font>】"
	  end if
	  %>&nbsp;<input type="button" value="修改" onclick="location.href='admin_city_mod.asp?ct=<%=rs("城市")%>'">&nbsp;</td>
    </tr>
</table>
<hr color="#000000" width="90%">
<%
RowCount = RowCount - 1 
rs.MoveNext 
Loop
rs.close
set rs=nothing
%>
<table width="90%" border="0" cellpadding="10" cellspacing="0">
  <tr>
    <td align="right" style="line-height: 16pt"><a href="#">&gt;&gt;<span lang="zh-cn">返回</span>TOP&lt;&lt;</a></td>
  </tr>
</table>
</body>
</html>

⌨️ 快捷键说明

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