📄 faluse_mod.asp
字号:
<!--#include file="include/conn.asp"-->
<!--#include file="include/function.asp"-->
<!--#include file="CheckSystem.asp"-->
<%
call checklimit(session("Limit"),"7")'调用验证管理员权限的函数
response.Clear()
auto=request.QueryString("auto")
myActionStr="添加"
flyDate=date+1
endDatetime=date+2
ifActiveStr="checked"
if auto<>"" then
usql="select * from repbunk where auto="&auto
set urs=server.CreateObject("adodb.recordset")
urs.open usql,conn,1,1
if not urs.eof then
auto=urs("auto")
FlightNo=urs("FlightNo")
bunk=urs("bunk")
flyDate=urs("flyDate")
enddatetime=urs("enddatetime")
ifDynamicBunk=urs("ifDynamicBunk")
ifActive=urs("ifActive")
if ifActive<>"1" then
ifActivestr=""
end if
datetime=date()
end if
urs.close
set urs=nothing
myActionStr="更新"
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" src="include/newjs/calendar.js"></script>
<SCRIPT language=javascript>
<!--
function isLineCode(s)
{
var patrn=/^[0-9a-zA-Z]{6}$/;
if (!patrn.exec(s))
return false;
else
return true;
}
function isbunk(s)
{
var patrn=/^[a-zA-Z]{0,10}$/;
if (!patrn.exec(s))
return false;
else
return true;
}
function checkinput()
{
if (!isLineCode(ZXLform.FlightNo.value)){
alert("航班号不规范!必须为6个字母或数字,不区分大小写;\n");
ZXLform.FlightNo.focus();
return false;
}
if (!isbunk(ZXLform.bunk.value)){
alert("舱位列表不规范!必须字母,不区分大小写;\n");
ZXLform.bunk.focus();
return false;
}
if(!isDateString(ZXLform.flyDate.value)||ZXLform.flyDate.value=="yyyy-mm-dd")
{
alert("请输入正确的日期格式!");
ZXLform.flyDate.focus();
return false;
}
if(!isDateString(ZXLform.enddatetime.value)||ZXLform.enddatetime.value=="yyyy-mm-dd")
{
alert("请输入正确的日期格式!");
ZXLform.enddatetime.focus();
return false;
}
return true;
//-->
}
function isDateString(sDate)//日期格式检查
{
var iaMonthDays = [31,28,31,30,31,30,31,31,30,31,30,31]
var iaDate = new Array(3)
var year, month, day
if (arguments.length != 1) return false
iaDate = sDate.toString().split("-")
if (iaDate.length != 3) return false
if (iaDate[1].length > 2 || iaDate[2].length > 2) return false
year = parseFloat(iaDate[0])
month = parseFloat(iaDate[1])
day=parseFloat(iaDate[2])
if (year < 1900 || year > 2100) return false
if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) iaMonthDays[1]=29;
if (month < 1 || month > 12) return false
if (day < 1 || day > iaMonthDays[month - 1]) return false
return true
}
</SCRIPT>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" >
<table width="770" border="0" cellpadding="0" cellspacing="0">
<tr>
<td valign="top">
<TABLE width=100% border=0 align="center" cellPadding=0 cellSpacing=1 bgcolor="#999999" id=TABLE1 style="FONT-SIZE: 9pt">
<form name="ZXLform" action="faluse_mod.asp" method="post" onsubmit="return checkinput();">
<TR bgColor=#C3E7F9>
<TH height="30">航班号</TH>
<TH width="256" height="30" bgcolor="#C3E7F9" style="padding-left:5px"> 航班日期</TH>
<TH> 舱位(可多个舱位)</TH>
<TH>有效</TH>
<TH width="92" height="30" colspan="5" bgcolor="#C3E7F9" style="padding-left:5px">更新时间</TH>
</TR>
<%if auto="" then%>
<input type="hidden" name="MyAction" value="AddNew">
<%end if%>
<input type="hidden" name="Auto" value="<%=auto%>">
<input type="hidden" name="myActionStr" value="<%=myActionStr%>">
<TR bgcolor="#FFFFFF" >
<TD width="79" height="25" align=center>
<input name="FlightNo" type="text" id="FlightNo" value="<%=FlightNo%>" size="8" maxlength="6">
</TD>
<TD height="25" align="center" nowrap style="padding-left:3px">
<input name="flyDate" type="text" value="<%=flyDate%>" size="12" maxlength="16" onclick=javascript:calendar(); >
-->
<input name="enddatetime" type="text" value="<%=enddatetime%>" size="12" maxlength="16" onclick=javascript:calendar(); ></TD>
<TD width="143" height="25"><div align="center">
<input name="bunk" type="text" value="<%=bunk%>" size="16" maxlength="6">
</div></TD>
<TD width="34" height="25" align="center"><input name="ifActiveStr" type="checkbox" value="ON" <%=ifActiveStr%>></TD>
<TD height="25" colspan="5" align="center" bgcolor="#FFFFFF" style="padding-left:3px"><div align="center">
<%if auto<>"" then
datetime=datetime
else
datetime=date()
end if
response.write datetime
%>
<input name="datetime" type="hidden" value="<%=datetime%>" size="10">
</div></TD>
</TR>
<TR bgColor=#EEEEEE>
<TH height="30" colspan="10">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="48%" height="25" align="right">
<input type="submit" name="AddNow" value="确认">
<input type="button" value="返回" name="CancelRow" onClick="javascript:window.location.href='faluse.asp';">
</td>
</tr>
</table></TH>
</TR>
</form>
</TABLE></td>
</tr>
</table>
</body>
</html>
<%
if Request.ServerVariables("REQUEST_METHOD")="POST" then
set rs=server.createobject("adodb.recordset")
MyAction=testdb(request.form("MyAction"))'标志变量,判断是更新还是添加
myActionStr=testdb(request.form("myActionStr"))
auto=testdb(request.form("auto"))
FlightNo=testdb(request.form("FlightNo"))
bunk=testdb(request.form("bunk"))
flyDate=testdb(request.form("flyDate"))
enddatetime=testdb(request.form("enddatetime"))
ifDynamicBunk=testdb(request.form("ifDynamicBunk"))
datetime=testdb(request.form("datetime"))
ifActivestr=testdb(request.form("ifActivestr"))
if ifActivestr="ON" then
ifActive=1
else
ifActive=0
end if
'----------------执行更行
if MyAction<>"AddNew" then
sql="select * from repbunk where auto="&auto
rs.open sql,conn,1,3
rs("FlightNo")=FlightNo
rs("bunk")=bunk
if isdate(flyDate) then
rs("flyDate")=flyDate
end if
if isdate(enddatetime) then
rs("enddatetime")=enddatetime
end if
rs("datetime")=datetime
rs("ifActive")=ifActive
if ifDynamicBunk<>"" then
rs("ifDynamicBunk")=1
end if
rs.update
else
sql="select * from repbunk"
rs.open sql,conn,1,3
rs.addnew
rs("FlightNo")=FlightNo
rs("bunk")=bunk
if isdate(flyDate) then
rs("flyDate")=flyDate
end if
if isdate(enddatetime) then
rs("enddatetime")=enddatetime
end if
rs("datetime")=datetime
rs("ifActive")=ifActive
if ifDynamicBunk<>"" then
rs("ifDynamicBunk")=1
end if
rs.update
end if
rs.close:set rs=nothing
response.write"<script language=javascript>alert('记录已经"&myActionStr&"成功!\n');window.location.href='faluse.asp';</script>"
end if
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -