📄 savefileinfo.asp
字号:
<!--#include file="conn.asp"-->
<%'===========================验证表单内容是否合法(开始)====================================================================%>
<%
title=trim(request.form("title"))
authorname=trim(request.form("authorname"))
sex=trim(request.form("sex"))
chusheng=trim(request.form("chusheng"))
xuewei=trim(request.form("xuewei"))
zhicheng=trim(request.form("zhicheng"))
shuoming=trim(request.form("shuoming"))
youbian=trim(request.form("youbian"))
user=trim(request.form("user"))
other=trim(request.form("other"))
id=trim(request.form("id"))
danwei=trim(request.form("danwei"))
fileid=cstr(trim(request.QueryString("id")))
fileid2=cstr(trim(session("fileid")))
if fileid<>"" then
if fileid<>fileid2 then
response.write "<SCRIPT language=JavaScript>alert('非法进入,如果你确定你的操作正确,请与编辑部联系');this.location.href='vbscript:history.back()';</SCRIPT>"
response.end
end if
end if
if id<>"" then
'response.Write authorname&sex&xuewei&chusheng&zhicheng&danwei
err=0
if authorname="" or sex="" or chusheng="" or xuewei="" or zhicheng="" or danwei="" or title="" then
response.write "<SCRIPT language=JavaScript>alert('必须填写第一作者详细信息');this.location.href='vbscript:history.back()';</SCRIPT>"
err=1
end if
if instr(Request("authorname")," ")>0 or instr(Request("authorname"),"'")>0 then
response.write "<SCRIPT language=JavaScript>alert('姓名中含有非法字符');this.location.href='vbscript:history.back()';</SCRIPT>"
err=1
end if
if len(authorname)>8 or len(authorname)<2 then
response.write "<SCRIPT language=JavaScript>alert('姓名不能大于4个汉字或小于一个汉字');this.location.href='vbscript:history.back()';</SCRIPT>"
err=1
end if
if len(chusheng)>16 or len(chusheng)<2 then
response.write "<SCRIPT language=JavaScript>alert('请填写正确出生年月');this.location.href='vbscript:history.back()';</SCRIPT>"
err=1
end if
if len(xuewei)>16 then
response.write "<SCRIPT language=JavaScript>alert('第一学位字数不得超过8个汉字');this.location.href='vbscript:history.back()';</SCRIPT>"
err=1
end if
if not(isnumeric(youbian)) or len(youbian)<>6 then
response.write "<SCRIPT language=JavaScript>alert('请正确输入邮编');this.location.href='vbscript:history.back()';</SCRIPT>"
err=1
end if
if not(isnumeric(youbian)) then
response.write "<SCRIPT language=JavaScript>alert('邮编必须是数字');this.location.href='vbscript:history.back()';</SCRIPT>"
err=1
end if
if len(danwei)>60 then
response.write "<SCRIPT language=JavaScript>alert('单位名称不能大于30字');this.location.href='vbscript:history.back()';</SCRIPT>"
err=1
end if
'===================验证表单内容是否合法(结束)======================
'========================将表单的内容插入到数据库中============================
if err=0 then
sql="select * from file where id="&id
rs.open sql,conn,1,2
rs("title")=title
rs("authorname")=authorname
rs("sex")=sex
rs("chusheng")=chusheng
rs("xuewei")=xuewei
rs("zhicheng")=zhicheng
rs("danwei")=danwei
rs("youbian")=youbian
rs("other")=other
rs("shuoming")=shuoming
rs("zt")=2
rs("date")=date()'=在数据库里插入当前的时间,格式为年,月,日
rs.update
rs.close
conn.close
set rs=nothing
response.write "<SCRIPT language=JavaScript>alert('成功发送稿件');</SCRIPT>"
response.Redirect ("login_ok.asp")
response.End()
end if
end if
'===========================================插入结束=============================
%>
<html>
<head>
<link href="style.css" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
body,td,th {
font-family: Arial, Helvetica, sans-serif;
font-size: 16px;
}
a {
font-family: Arial, Helvetica, sans-serif;
font-size: 16px;
}
-->
</style></head>
<body>
<form name="form1" method="post" action="savefileinfo.asp">
<table width="600" border="0">
<tr>
<td height="26"><div align="center">文章题目</div></td>
<td height="26"><input type="text" name="title"></td>
</tr>
<tr>
<td width="25%" height="26"><div align="center">第一作者</div></td>
<td width="75%" height="26"><input type="text" name="authorname"></td>
</tr>
<tr>
<td height="26"><div align="center">作者性别</div></td>
<td height="26"><select name="sex">
<option value="男">男</option>
<option value="女">女</option>
</select></td>
</tr>
<tr>
<td height="26"><div align="center">出生年月</div></td>
<td height="26"><input type="text" name="chusheng"></td>
</tr>
<tr>
<td height="26"><div align="center">第一学位</div></td>
<td height="26"><input type="text" name="xuewei"></td>
</tr>
<tr>
<td height="26"><div align="center">职 称</div></td>
<td height="26"><input type="text" name="zhicheng"></td>
</tr>
<tr>
<td height="26"><div align="center">工作单位</div></td>
<td height="26"><input type="text" name="danwei"></td>
</tr>
<tr>
<td height="26"><div align="center">邮 编</div></td>
<td height="26"><div align="left">
<input type="text" name="youbian">
</div></td>
</tr>
<tr>
<td height="26"><div align="center">其他作者</div></td>
<td height="26"><input type="text" name="other">
(姓名、工作单位、邮政编码)</td>
</tr>
<tr>
<td height="26"><div align="center">稿件说明</div></td>
<td height="26"><textarea name="shuoming" wrap="off" ></textarea></td>
</tr>
<tr>
<td height="26"><div align="center"></div></td>
<td height="26"><div align="left">
<input type="hidden" name="id" value="<%=fileid%>">
</div></td>
</tr>
<tr>
<td height="26" colspan="2"><div align="center"></div> <div align="left">
<input name="Submit" type="submit" class="bt" value="提交">
<input name="Submit2" type="reset" class="bt" value="重置">
</div></td>
</tr>
<tr>
<td height="26"><div align="center"></div></td>
<td height="26"><div align="left"></div></td>
</tr>
<tr>
<td height="26"><div align="center"></div></td>
<td height="26"><div align="left"></div></td>
</tr>
<tr>
<td height="26"><div align="center"></div></td>
<td height="26"><div align="left"></div></td>
</tr>
</table>
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -