📄 fly_type_mod.asp
字号:
<!--#include file="include/conn.asp"-->
<!--#include file="CheckSystem.asp"-->
<%
call checklimit(session("Limit"),"8")'调用验证管理员权限的函数
response.Clear()
%>
<%
if Request.ServerVariables("REQUEST_METHOD")="POST" then
set rs=server.createobject("adodb.recordset")
MyAction=request.form("MyAction")'标志变量,判断是更新还是添加
myActionStr=request.form("myActionStr")
id=request.form("id")
FlyName=request.form("FlyName")
FlyType=request.form("FlyType")
FlyInfro=request.form("FlyInfro")
updatetime=request.form("updatetime")
file1=request.Form("file1")
if MyAction<>"AddNew" then '执行更行
sql="select * from TplaneType where id="&id
rs.open sql,conn,1,3
else
sqlid="select distinct max(id) as id from TplaneType"
set rsid=conn.execute(sqlid)
id=rsid("id")
if id="" then
id=1
else
id=id+1
end if
sql="select * from TplaneType"
rs.open sql,conn,1,3
rs.addnew
rs("id")=id
end if
rs("name")=FlyName
rs("airname")=FlyType
rs("airtext")=FlyInfro
if file1<>"" then
rs("airpic")=file1
end if
rs("updatetime")=updatetime
rs.update
rs.close:set rs=nothing
response.write"<script language=javascript>alert('记录已经"&myActionStr&"成功!\n');window.location.href='Fly_type.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 isFlyName(s)
{
var patrn=/^[0-9a-zA-Z]{2,6}$/;
if (!patrn.exec(s))
return false;
else
return true;
}
function isenglishcity(s)
{
var patrn=/^[0-9a-zA-Z]{0,50}$/;
if (!patrn.exec(s))
return false;
else
return true;
}
function checkinput()
{
if (!isFlyName(ZXLform.FlyName.value)){
alert("飞机名称不规范!必须为字母或数字,不区分大小写;\n");
ZXLform.FlyName.focus();
return false;
}
if (ZXLform.FlyType.value=="")
{
alert("飞机型号不能为空!");
ZXLform.FlyType.focus();
return false;
}
return true;
//-->
}
</SCRIPT>
<body >
<%
id=request.QueryString("id")
myActionStr="添加"
if id<>"" then
usql="select * from TplaneType where id="&id
set urs=server.CreateObject("adodb.recordset")
urs.open usql,conn,1,1
if not urs.eof then
id=urs("id")
FlyName=urs("name")
FlyType=urs("airname")
FlyInfro=urs("airtext")
file1=urs("airpic")
updatetime=now()
end if
urs.close
set urs=nothing
myActionStr="更新"
end if
%>
<TABLE cellPadding=0 cellSpacing=1 bgcolor="#999999" >
<form name="ZXLform" action="Fly_type_mod.asp" method="post" onSubmit="return checkinput();" >
<TR bgColor=#C3E7F9>
<TH width="10%" height="30">飞机型号</TH>
<td width="66%" align="left" bgcolor="#FFFFFF" style="padding-left:20px">
<input name="FlyName" type="text" value="<%=FlyName%>" size="30">
<%if id="" then%>
<input type="hidden" name="MyAction" value="AddNew">
<%end if%>
<input type="hidden" name="id" value="<%=id%>">
<input type="hidden" name="myActionStr" value="<%=myActionStr%>">
</td>
<td width="24%" rowspan="3" align="left" bgcolor="#FFFFFF" style="padding-left:20px">
<%if trim(file1)<>"" and not isnull(file1) then%>
<img src="../aircompanyimg/<%=file1%>">
<%end if%>
</td>
</TR>
<TR bgcolor="#FFFFFF" >
<TH height="30" bgcolor="#C3E7F9">飞机名称 </TH>
<TD bgcolor="#FFFFFF" style="padding-left:20px">
<input name="FlyType" type="text" value="<%=FlyType%>" size="30"> </TD>
</TR>
<TR bgColor=#C3E7F9>
<TH bgcolor="#C3E7F9">说 明</TH>
<Td align="left" bgcolor="#FFFFFF" style="padding-left:20px">
<textarea name="FlyInfro" cols="60" rows="4"><%=FlyInfro%></textarea>
</Td>
</TR>
<TR bgColor=#C3E7F9>
<TH height="30">飞机图片</TH>
<Td colspan="2" align="left" bgcolor="#FFFFFF" style="padding-left:20px">
<input name="file1" type="text" value="<%=file1%>" size="30" maxlength="100">
<input type="button" name="btn" value=" 浏 览 " onClick="window.open('upload_flash.asp?formname=ZXLform&editname=file1&uppath=../aircompanyimg&filelx=jpg','','status=no,scrollbars=no,top=20,left=110,width=420,height=165')">
</Td>
</TR>
<TR bgColor=#C3E7F9>
<TH height="30">更新时间</TH>
<Td colspan="2" align="left" bgcolor="#FFFFFF" style="padding-left:20px">
<%if id<>"" then%>
<%=Updatetime%>
<input name="Updatetime" type="hidden" value="<%=Updatetime%>" size="10">
<%else%>
<%=now()%>
<input name="Updatetime" type="hidden" value="<%=date()%>" size="10">
<%end if%> </Td>
</TR>
<TR bgColor=#EEEEEE>
<td height="30" colspan="3" align="right" style="padding-right:30px;">
<input type="submit" name="sbt" value=" 确 认 ">
<input type="button" value=" 返 回 " name="CancelRow" onClick="javascript:window.history.back();"> </td>
</TR>
</form>
</TABLE>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -