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

📄 place.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"
		place_name = DellrBlank("place_name",1)
		'place_fro = DellrBlank("place_fro",1)
		city = DellrBlank("city",1)
		area = DellrBlank("area",1)
		if place_name = "" then
			response.Write("<script>window.alert(""请输入区域名称!!"");history.back()</script>")
			set fso = nothing
			conn.close
			set conn = nothing
			response.End()
		end if
		
		if city = "xxx" or area = "xxx" then
			response.Write("<script>window.alert(""请选择城市和地区!!"");history.back()</script>")
			set fso = nothing
			conn.close
			set conn = nothing
			response.End()
		end if
		SQL = "select * from place where place_name='" & place_name & "' and place_city="&clng(city)&" and place_area="&clng(area)&""
		Set rs = server.CreateObject("adodb.recordset")
		rs.open SQL,conn,1,3
		if not (rs.eof and rs.bof) then
			response.Write("<script>window.alert(""该区域名称已经被选用\n\n请重新选择!!"");history.back()</script>")
			set fso = nothing
			rs.close
			set rs = nothing
			conn.close
			set conn = nothing
			response.End()
		else
			rs.addnew
				rs("place_name") = place_name
				rs("place_fro") = place_fro
				rs("place_city") = clng(city)
				rs("place_area") = clng(area)
			rs.update
			rs.close
			set rs = nothing
			call MakeCityArea
			call MakeCityArea02
			call MakeAreaPlace
			set fso = nothing
		end if
		case "del"
			place_id = TxtToLng("place_id",2)
			Set rs2 = server.CreateObject("adodb.recordset")
			SQL = "select * from city_area_place where place_id=" & place_id
			rs2.open SQL,conn,1,1
			conn.execute("delete from ad_mes where ad_place="&place_id)
			conn.execute("delete from place where place_id=" & place_id)
			rs2.close
			set rs2 = nothing
			call MakeCityArea
			call MakeCityArea02
			call MakeAreaPlace
			set fso = nothing
end select
%>
<%
sel_city = DellrBlank("sel_city",1)
sel_area = DellrBlank("sel_area",1)

city_id = DellrBlank("city_id",3)
area_id = DellrBlank("area_id",3)
set rs = server.CreateObject("adodb.recordset")
if sel_city = "xxx" or sel_city = "" or sel_area = "xxx" or sel_area = "" then
	if city_id = "" or area_id = "" then'第一次进入
		SQL = "select * from city_area_place where city_name='武汉' and area_name='青山'"
		city_name = "武汉"
		area_name = "青山"
		set rs2 = conn.execute("select id,area_id from city_area where city_name='武汉' and area_name='青山'")
		city_id = rs2("id")
		area_id = rs2("area_id")
		rs2.close
		set rs2 = nothing
	else'操作
		SQL = "select * from city_area_place where id=" & clng(city_id) & " and area_id=" & clng(area_id)
		set rs2 = conn.execute("select * from city_area where id=" & clng(city_id) & " and area_id=" & clng(area_id))
		city_name = rs2("city_name")
		area_name = rs2("area_name")
		city_id = rs2("id")
		area_id = rs2("area_id")
		rs2.close
		set rs2 = nothing
	end if
else'查询
	SQL = "select * from city_area_place where id=" & clng(sel_city) & " and area_id=" & clng(sel_area)
	set rs2 = conn.execute("select * from city_area where id=" & clng(sel_city) & " and area_id=" & clng(sel_area))
	city_name = rs2("city_name")
	area_name = rs2("area_name")
	city_id = rs2("id")
	area_id = rs2("area_id")
	rs2.close
	set rs2 = nothing
end if

rs.open SQL,conn,1,1
'city_id = rs("id")
'area_id = rs("area_id")
'city_name = rs("city_name")
'area_name = rs("area_name")
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<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>
<script language="JavaScript" src="../../conn/cityarea.js"></script>
<script language="JavaScript" src="../../conn/cityarea02.js"></script>
<title>区域管理</title>
</head>
<script language="javascript">
function run(){
	chsel();
	chsel02();
}

function openScript(url){
var Win = window.open(url,"openScript",'width=290,height=200,left=450,top=300,resizable=1,scrollbars=no,menubar=no,status=no' );
}
</script>
<body onLoad="run()">
<table width="90%" border="0" align="center" cellpadding="4" cellspacing="1" bgcolor="#336633">
  <tr> 
	<td height="25" colspan="4"  background="../Images/topbg.gif">区域管理 &gt;&gt; 修改及删除地区</td>
  </tr>
  <tr> 
	<td height="25" colspan="4" bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="0">
		<tr> 
		  <td width="35%">你选择的区域是:<strong><%=city_name%>&nbsp;&gt;&gt;&nbsp;<%=area_name%></strong></td>
		  <script language="javascript">
		  	function checksel(){
				if(document.formsel.sel_city.value=='xxx'){
					alert("请选择所属城市!!");
					return false;
					document.formsel.sel_city.focus();
				}
			}
		  </script>
		  <td width="65%" align="right"><form name="formsel" id="formsel" method="post" action="?" onSubmit="return checksel()">
		  		选择城市:
		  						<select name="sel_city" id="sel_city" onChange="chsel02()">
									<option value="xxx" selected>请选择所属城市</option>
									<%call ListCity%>
                                </select>		  					
		  						&nbsp;&nbsp;	选择地区:
		  		                <select name="sel_area" id="sel_area"  style="width:100">
                		</select>
		  		<input type="submit" name="Submit2" value="查询" class="button01">
  		        </form></td>
		</tr>
	  </table></td>
  </tr>
  <tr align="center"> 
	<td width="26%" height="25" bgcolor="#FFFFFF">区域名称</td>
	<td width="28%" bgcolor="#FFFFFF">所属城市</td>
	<td width="26%" bgcolor="#FFFFFF">所属地区</td>
	<td width="20%" bgcolor="#FFFFFF">操作</td>
  </tr>
	

  <%
  while not rs.eof
  %>
  <tr align="center"> 
	<td height="25" bgcolor="#FFFFFF"><%=rs("place_name")%></td>
	<td height="25" bgcolor="#FFFFFF"><%=rs("city_name")%></td>
	<td height="25" bgcolor="#FFFFFF"><%=rs("area_name")%></td>

	<td height="25" bgcolor="#FFFFFF"><a href="javascript:" onClick="openScript('place_cha.asp?place_id=<%=rs("place_id")%>&city_id=<%=city_id%>&area_id=<%=area_id%>')">修改</a> <a href="?action=del&place_id=<%=rs("place_id")%>&city_id=<%=city_id%>&area_id=<%=area_id%>">删除</a></td>
  </tr>
  <%
  	rs.movenext
  wend
  %>
</table>
<p>&nbsp;</p>
<script language="javascript">
function checkadd(){
	if(document.formaddplace.place_name.value==''){
		alert('请输入区域名称!!');
		return false;
		document.formaddplace.place_name.focus();
	}
	
	if(document.formaddplace.city.value=='xxx'){
		alert('请选择所属城市!!');
		return false;
		document.formaddplace.city.focus();
	}
}
</script>
<form name="formaddplace" method="post" action="?action=add" onSubmit="return checkadd()">
  <table width="90%" border="0" align="center" cellpadding="4" cellspacing="1" bgcolor="#336633">
	<tr align="left" bgcolor="#FFFFFF"> 
	  <td height="25" colspan="4" background="../Images/topbg.gif">区域管理 &gt;&gt; 添加区域</td>
	  </tr>
	<tr align="center" bgcolor="#FFFFFF"> 
	  <td height="25">区域名称:
		<input name="place_name" type="text" class="txttable"></td>
	  <td height="25">所属城市 
	  		<select name="city" id="city" onChange=chsel()>
	  				<option value="xxx" selected>请选择所属城市</option>
					<%call ListCity%>
    		</select></td>
	  <td>所属地区 <select name="area" id="area" style="width:100">
		</select></td>
	  <td><input type="hidden" name="city_id" value="<%=city_id%>">
	  		<input type="hidden" name="area_id" value="<%=area_id%>">
	  <input type="submit" name="Submit" value="添加" class="button01"></td>
	</tr>
  </table>
</form>
<p>&nbsp;</p>
</body>
</html>

⌨️ 快捷键说明

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