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

📄 area.asp

📁 信息管理系统!很简单的课程设计!类似于城市信息交换的网站!
💻 ASP
字号:
<%'注意:防止多次发送,以及防止非法登录
server_v1=Cstr(Request.ServerVariables("HTTP_REFERER"))
server_v2=Cstr(Request.ServerVariables("SERVER_NAME"))
if not mid(server_v1,8,len(server_v2))=server_v2 then
Response.Write "<script language=JavaScript>{window.alert('系统错误,拒绝从非本服务器登陆!');window.history.go(-1);}</script>"
response.end
end if

if session("admin_login")<>true then
	response.Write("<html><link href=../style.css rel=stylesheet type=text/css><body><table height=100% width=100% align=center valign=middle><tr><td align=center valign=center><p align=center>您没有登录或者已经超时!!请点击下面的链接,进入登录界面!!</p><p align=center>--&gt;&gt; <a href=../login/login.asp>登录</a> &lt;&lt;--</p></td></tr></table></body></html>")
	response.end
end if
%>

<!--#include file="../../conn/conn.asp"-->
<!--#include file="../../conn/fun.asp"-->
<!--#include file="../../conn/fso.asp"-->
<%
action = DellrBlank("action",2)
select case action
	case "add"
		area_name = DellrBlank("area_name",1)
		if area_name = "" then
			response.Write("<script>window.alert(""请输入地区名!!"");history.back()</script>")
			Set fso = Nothing
			conn.close
			set conn = noting
			Response.End()
		end if
		
		area_city = TxtToLng("area_city",1)
		
		if Isnull(area_city) or Not IsNumeric(area_city) then
			response.Write("<script>window.alert(""请选择所属城市!!"");history.back()</script>")
			Set fso = Nothing
			conn.close
			set conn = noting
			Response.End()
		end if
		
		SQL = "select * from area where area_city="& area_city &" and area_name='" & area_name & "'"
		Set rs = Server.CreateObject("adodb.recordset")
		rs.open SQL,conn,1,3
		if rs.eof and rs.bof then
			rs.addnew
			rs("area_name") = area_name
			rs("area_fro") = area_fro
			rs("area_city") = area_city
			rs.update
			
			rs.close
			set rs = nothing
			'call MakeCityArea
			call MakeCityArea02
			'call MakeAreaPlace
			Set fso = Nothing
		else
			response.Write("<script>window.alert(""该地区名已经被使用了,请重新选择!!"");history.back()</script>")
			Set fso = Nothing
			conn.close
			set conn = noting
			Response.End()
		end if
	case "del"
		area_id = TxtToLng("area_id",2)
		set rsdel = server.CreateObject("ADODB.recordset")
		rsdel.open "select * from city_area where area_id=" & area_id,conn,1,1
		if not (rsdel.eof and rsdel.bof) then
			'删除广告
			conn.execute("delete from ad_mes where ad_area="&area_id)
			'conn.execute("delete from place where place_area=" & area_id)
			conn.execute("delete from area where area_id=" & area_id)
		end if
		rsdel.close
		set rsdel = nothing
		'call MakeCityArea
		call MakeCityArea02
		'call MakeAreaPlace
	case "change"
		area_id = TxtToLng("area_id",1)
		area_name = DellrBlank("area_name",1)
		if area_name = "" then
			response.Write("<script>window.alert(""请输入地区名!!"");history.back()</script>")
			set fso = nothing
			conn.close
			set conn = nothing
			response.End()
		end if
		area_city = TxtToLng("area_city",1)
		SQL = "update area set area_name='" & area_name & "',area_city=" & area_city & " where area_id=" & area_id
		conn.execute(SQL)
		'call MakeCityArea
		call MakeCityArea02
		'call MakeAreaPlace
end select

selcit = DellrBlank("selcit",3)
statu = "where "
if selcit<>"" then
	id = cLng(selcit)
	statu = statu & "id=" & id & " "
else
	statu = statu & "city_name='武汉'"
end if
SQL = "select * from city_area " & statu & " order by area_id desc"
set rs=server.CreateObject("adodb.recordset")
rs.open sql,conn,1,1
id = clng(rs("id"))
citnam = rs("city_name")
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<!-- no cache headers -->
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="no-cache">
<meta http-equiv="Expires" content="-1">
<meta http-equiv="Cache-Control" content="no-cache">
<!-- end no cache headers -->
<link href="../style.css" rel="stylesheet" type="text/css">
<STYLE type="text/css">
  <!--
   BODY {
    scrollbar-face-color:#ffffff;
    scrollbar-arrow-color:#000000;
    scrollbar-highlight-color:#C0C0C0;
    scrollbar-3dlight-color:#ffffff;
    scrollbar-shadow-color:#ffffff;
    scrollbar-darkshadow-color:#ffffff;
    scrollbar-track-color:#ffffff;
   }
  -->
  </STYLE>
<title>地区管理</title>
</head>

<body>
<table width="90%" border="0" align="center" cellpadding="4" cellspacing="1" bgcolor="#003300">
  <tr bgcolor="#FFFFFF"> 
	<td height="25" colspan="3" background="../Images/topbg.gif">地区管理 &gt;&gt; 修改及删除地区</td>
  </tr>
  <tr bgcolor="#FFFFFF">
	<td height="25" colspan="3"><table width="100%" border="0" cellspacing="0" cellpadding="0">
		<tr> 
		  <td width="31%">你选择的城市是:<strong><%=citnam%></strong></td>
		  <td align="right">
		  <script language="JavaScript">
		  	function gotocity(obj){
				cityid=obj.value
				window.location.href="area.asp?selcit="+cityid
			}
		  </script> 
			<form name="ForSelcit" method="post" action="?">
			  选择城市: 
			  <select name="selcit" onChange="gotocity(this)">
				<%call ListCity2(id)%>
			  </select>
			</form></td>
		</tr>
	  </table></td>
  </tr>
  <tr align="center" bgcolor="#FFFFFF"> 
	<td height="25">地区名称</td>
	<td>所属城市</td>
	<td>操作</td>
  </tr>
  <%
  while not rs.eof
  %>
  <form name="form<%=rs("area_id")%>" method="post" action="?action=change" onSubmit="return check(this)">
	<tr align="center" bgcolor="#FFFFFF"> 
	  <td height="25"><input name="area_name" type="text" class="txttable" value="<%=rs("area_name")%>"></td>
	  <td><select name="area_city" class="txttable">
		  		<%ListCity2(id)%>
		</select>
		    <input type="hidden" name="selcit" value="<%=id%>">
		    <input type="hidden" name="area_id" value="<%=rs("area_id")%>"></td>
	  <td><input type="submit" name="Submit<%=rs("area_id")%>" value="修改" class="button02" onMouseOver="this.className='button03'" onMouseOut="this.className='button02'">&nbsp; <a href="?action=del&selcit=<%=id%>&area_id=<%=rs("area_id")%>">删除</a></td>
	</tr>
  </form>
  <%
  	rs.movenext
  wend
  %>
</table>
<p>&nbsp;</p>
<script language="JavaScript">
function checkadd(){
	if(document.formareaadd.area_name.value==''){
		alert("请输入地区名称!!");
		return false;
		document.formareaadd.area_name.focus();
	}
	
	if(document.formareaadd.area_city.value==''){
		alert("请选择所属城市!!");
		return false;
		document.formareaadd.area_city.focus();
	}
}
</script>
<form name="formareaadd" method="post" action="?action=add" onsubmit="return checkadd()">
  <table width="90%" border="0" align="center" cellpadding="4" cellspacing="1" bgcolor="#003300">
	<tr bgcolor="#FFFFFF"> 
	  <td height="25" colspan="3" background="../Images/topbg.gif">地区管理 &gt;&gt; 添加地区</td>
	</tr>
	<tr bgcolor="#FFFFFF"> 
	  <td width="47%" height="25" align="center">地区名称: 
		<input name="area_name" type="text" size="10" class="txttable"></td>
	  <td width="41%" align="center">所属城市: 
		    <select name="area_city" class="txttable">
		  		<option value="" selected >请选择所属城市</option>
		  		<%ListCity%>
    		</select>
		    <input type="hidden" name="selcit" value="<%=id%>"></td>
	  <td width="12%" align="center"><input type="submit" name="Submit" value="添加" class="button01"></td>
	</tr>
  </table>
</form>
<p align="center"><font color="#FF0000">注意</font>:文件夹名请用<font color="#FF0000">英文</font>字母</p>
</body>
</html>

⌨️ 快捷键说明

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