📄 fly_city_mod.asp
字号:
<!--#include file="include/conn.asp"-->
<!--#include file="include/function.asp"-->
<!--#include file="CheckSystem.asp"-->
<%
SetLimit=session("Limit")
call checklimit(SetLimit,"2")'调用验证管理员权限的函数
response.Clear()
%>
<%
if Request.ServerVariables("REQUEST_METHOD")="POST" then
MyAction=testdb(request.form("MyAction"))'标志变量,判断是更新还是添加
myActionStr=testdb(request.form("myActionStr"))
CityCode=testdb(request.form("CityCode"))
CityName=testdb(request.form("CityName"))
EnglishName=testdb(request.form("EnglishName"))
Country=testdb(request.form("Country"))
Province=testdb(request.form("Province"))
AirPortName=testdb(request.form("AirPortName"))
EngAirPortName=testdb(request.form("EngAirPortName"))
AirPortRoute=testdb(request.form("AirPortRoute"))
AirPortText=testdb(request.form("AirPortText"))
Memo=testdb(request.form("Memo"))
updatetime=testdb(request.form("updatetime"))
set rs=server.createobject("adodb.recordset")
if MyAction<>"AddNew" and CityCode<>"" then '执行更新
sql="select * from city where CityCode='"&CityCode&"'"
rs.open sql,conn,1,3
else
sqlc="select * from city where CityCode='"&CityCode&"'"
set rsc=conn.execute(sqlc)
if not rsc.eof then
response.write("<script>alert('对不起,不能添加相同的城市代号!');window.history.back();</script>")
response.end
end if
sql="select * from city"
rs.open sql,conn,1,3
rs.addnew
end if
rs("CityCode")=CityCode
rs("CityName")=CityName
rs("EnglishName")=EnglishName
rs("Country")=Country
rs("Province")=Province
rs("AirPortName")=AirPortName
rs("EngAirPortName")=EngAirPortName
rs("AirPortText")=AirPortText
rs("AirPortRoute")=AirPortRoute
rs("Memo")=Memo
rs("updatetime")=updatetime
rs.update
rs.close:set rs=nothing
response.write"<script language=javascript>alert('记录已经"&myActionStr&"成功!');window.location.href='Fly_city.asp';</script>"
end if
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>后台管理机票系统</title>
<link href="include/css.css" rel="stylesheet" type="text/css">
</head>
<SCRIPT language=javascript>
<!--
function isCityCode(s)
{
var patrn=/^[a-zA-Z]{3}$/;
if (!patrn.exec(s))
return false;
else
return true;
}
function isenglishcity(s)
{
var patrn=/^[0-9a-zA-Z]{0,2}$/;
if (!patrn.exec(s))
return false;
else
return true;
}
function checkinput()
{
if (!isCityCode(ZXLform.CityCode.value)){
alert("城市代号不规范!必须为字母,不区分大小写;\n");
ZXLform.CityCode.focus();
return false;
}
if (ZXLform.CityName.value=="")
{
alert("城市名称不能为空!");
ZXLform.CityName.focus();
return false;
}
if (!isenglishcity(ZXLform.Country.value)){
alert("国家代号不规范!必须为字母或数字,不区分大小写;\n");
ZXLform.Country.focus();
return false;
}
return true;
//-->
}
</SCRIPT>
<body>
<%
CityCode=request.QueryString("CityCode")
myActionStr="添加"
if CityCode<>"" then
usql="select * from city where CityCode='"&CityCode&"'"
set urs=server.CreateObject("adodb.recordset")
urs.open usql,conn,1,1
if not urs.eof then
CityCode=urs("CityCode")
CityName=urs("CityName")
EnglishName=urs("EnglishName")
Country=urs("Country")
Province=urs("Province")
AirPortName=urs("AirPortName")
EngAirPortName=urs("EngAirPortName")
AirPortRoute=urs("AirPortRoute")
AirPortText=urs("AirPortText")
Memo=urs("Memo")
updatetime=now()
end if
urs.close
set urs=nothing
myActionStr="更新"
end if
%>
<TABLE width="98%" cellPadding=0 cellSpacing=1 id="TABLE1">
<form name="ZXLform" action="Fly_city_mod.asp" method="post" onSubmit="return checkinput();">
<TR bgColor=#C3E7F9>
<td width="10%" height="25" align="center" widtd="153">城市代号</td>
<td width="29%" bgcolor="#FFFFFF" widtd="300" ><input name="CityCode" type="text" value="<%=CityCode%>" size="6" maxlength="3"></td>
<td width="12%" align="center">城市英文名 </td>
<td width="49%" colspan="3" bgcolor="#FFFFFF" widtd="286"><input name="EnglishName" type="text" value="<%=EnglishName%>" size="25" maxlength="50"></td>
</TR>
<TR bgcolor="#FFFFFF" >
<TD height="25" align=center bgcolor="#C3E7F9">城市名称 </TD>
<TD height="25">
<input name="CityName" type="text" value="<%=CityName%>" size="25" maxlength="50"></TD>
<TD height="25" align="center" bgcolor="#C3E7F9" widtd="198">机 场 交 通</TD>
<TD height="25" colspan="3"><span >
<input name="AirPortRoute" type="text" id="AirPortRoute" value="<%=AirPortRoute%>" size="40" >
</span></TD>
</TR>
<TR bgcolor="#C3E7F9" >
<TD height="25" align=center>机场名称</TD>
<TD bgcolor="#FFFFFF"><input name="AirPortName" type="text" id="AirPortName" value="<%=AirPortName%>" size="25" maxlength="50"></TD>
<TD align="center" >机场英文名</TD>
<TD colspan="3" bgcolor="#FFFFFF" ><input name="EngAirPortName" type="text" id="EngAirPortName" value="<%=EngAirPortName%>" size="25" maxlength="50"></TD>
</TR>
<TR bgcolor="#FFFFFF" >
<TD height="25" align=center bgcolor="#C3E7F9" >国家名称</TD>
<TD align=left ><input name="Province" type="text" value="<%=Province%>" size="25" maxlength="50"></TD>
<TD align="center" bgcolor="#C3E7F9">国 家 代 号</TD>
<TD height="25" colspan="3" bgcolor="#FFFFFF"><input name="Country" type="text" value="<%=Country%>" size="6" maxlength="2"></TD>
</TR>
<TR bgcolor="#FFFFFF" >
<TD height="65" align=center bgcolor="#C3E7F9">机场说明</TD>
<TD colspan="5" ><textarea name="AirPortText" cols="50" rows="4" id="AirPortText"><%=AirPortText%></textarea> </TD>
</TR>
<TR bgcolor="#FFFFFF" >
<TD height="65" align=center bgcolor="#C3E7F9">备 注</TD>
<TD colspan="5" ><textarea name="Memo" cols="50" rows="4"><%=Memo%></textarea></TD>
</TR>
<TR bgColor=#EEEEEE>
<td height="30" colspan="7" align="right" style="padding-right:40px;">
<%if CityCode<>"" then
Updatetime=Updatetime
else
Updatetime=date()
end if
response.write Updatetime
%>
<input name="Updatetime" type="hidden" value="<%=Updatetime%>">
<%if CityCode="" then%>
<input type="hidden" name="MyAction" value="AddNew">
<%end if%>
<input type="hidden" name="myActionStr" value="<%=myActionStr%>">
<input type="submit" name="submit1" value="确认">
<input type="button" value="返回" name="CancelRow" onClick="javascript:window.location.href='Fly_city.asp';">
</td>
</TR>
</form>
</TABLE>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -