请求帮忙修改禁止多次重复提交

xwawa 2008-07-31 05:00:46
下面是提交表单的两个文件:index.asp和adminsave.asp(在附件内)的部分内容,请帮忙修改一下,让它能够禁止提交后返回提交页继续重复提交表单,主要是让返回提交页后清空原来的内容及限制再次提交的时间,谢谢!

index.asp


<table width="100%" border="0" align="center" cellpadding="4" cellspacing="1" >
<form method="POST" name="myform" action="adminsave.asp?action=add">

<tr bgcolor="#FFFFFF"> <td></td>
<td align="right">
<p align="left"><b><font color="#333333">注意:带</font><font color="#FF0000">*</font><font color="#333333">项目必须填写</font></b></td>
</tr>


<tr bgcolor="#FFFFFF">
<td align="right"><font color="#333333"><b>标 题:</b></font></td>
<td width="85%"> <font color="#333333">
<input type="text" name="txttitle" size="69"
class="input" maxlength="20">
</font><font color="#FF0000">*</font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="15%" align="right"><font color="#333333"><b>作 者:</b></font></td>
<td width="85%"> <font color="#333333">
<input type="text" name="writer" size="69"
class="input" maxlength="20">
</font><font color="#FF0000">*</font></td>
</tr>


<tr bgcolor="#FFFFFF">
<td width="15%" align="right"><font color="#333333"><b>联系QQ:</b></font></td>
<td width="85%"> <font color="#333333">
<input type="text" name="qq" size="69"
class="input" maxlength="9"></font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="15%" align="right"><font color="#333333"><b>邮 件:</b></font></td>
<td width="85%"> <font color="#333333">
<input type="text" name="email" size="69"
class="input" maxlength="20"></font> <font color="#FF0000">*</font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="15%" align="right"><font color="#333333"><b>单 位:</b></font></td>
<td width="85%"> <font color="#333333">
<input type="text" name="writefrom" size="69"
class="input" maxlength="100">
</font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="15%" align="right"><font color="#333333"><b>支持HTML:</b></font></td>
<td width="85%"> <font color="#333333">
<input type=checkbox name="htmlable" value="yes">
选择后文章全部支持HTML语法,UBB语法将没有任何作用</font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="15%" align="right" valign="top"><font color="#333333"><b>文章内容:</b></font></td>
<td width="85%">
<textarea name="txtcontent" cols="68" rows="2" style="display:none"></textarea>
<iframe ID="Editor" name="Editor" src="ubb/edit.htm?id=txtcontent" frameBorder="0" marginHeight="0" marginWidth="0" scrolling="No" style="height:323px;width:510px"></iframe>
</td>
</tr>

<tr bgcolor="#FFFFFF">
<td colspan="2" align="center"> <font color="#333333">
<input type="submit" value=" 添加 " name="cmdok" class="button">
<input type="reset" value=" 清除 " name="cmdcancel" class="button">
</font></td>
</tr>
</form>
</table>
...全文
173 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
rankisky 2008-08-04
  • 打赏
  • 举报
回复
1,禁止缓存
2,添加的时候写入一个cookies值或是一个session值。
3,添加的时候检测这个值。
xwawa 2008-08-04
  • 打赏
  • 举报
回复
各位帮我改下吧!谢谢了!
xwawa 2008-07-31
  • 打赏
  • 举报
回复
禁止按"后退"再提交同样内容,
bhtfg538 2008-07-31
  • 打赏
  • 举报
回复
已经很成熟了吧
session
验证码
限制一段时间内的操作次数 (用户名 ,ip)
令牌
wronging 2008-07-31
  • 打赏
  • 举报
回复
LZ的意思应该是当判断提成成功后就不能再提交吧
jhwcd 2008-07-31
  • 打赏
  • 举报
回复
根据什么方式判断重复提交,把要求写的详细点。
xwawa 2008-07-31
  • 打赏
  • 举报
回复
adminsave.asp

<!--#include file="conn.asp"-->
<!--#include file="char.asp"-->
<%
ip=request.ServerVariables("REMOTE_ADDR")
dim rs,sql
dim title
dim content
dim articleid
dim writer
dim ip
dim writefrom
dim qq
dim email
dim errmsg
dim founderr
founderr=false
if trim(request.form("txttitle"))="" then
founderr=true
errmsg="<li>文章标题不能为空</li>"
end if



If not (isNumeric(trim(request.form("qq"))) or trim(request.form("qq"))="") then
founderr=true
errmsg="<li>QQ号码必须为数字!</li>"
end if




if trim(request.form("email"))="" then
founderr=true
errmsg="<li>email不能为空</li>"
end if

if trim(request.form("email"))<>"" and instr(trim(request.form("email")),"@")=0 then
founderr=true
errmsg="<li>您的电子邮件地址或格式填写错误!</li>"
end if

if trim(request.form("txtcontent"))="" then
founderr=true
errmsg=errmsg+"<li>文章内容不能为空</li>"
end if

if founderr=false then
title=htmlencode(request.form("txttitle"))

if request("htmlable")="yes" then
content=htmlencode2(request("txtcontent"))
else
content=ubbcode(request.form("txtcontent"))
end if

set rs=server.createobject("adodb.recordset")
if request("action")="add" then
call newsoft()
elseif request("action")="edit" then
call editsoft()
else
founderr=true
errmsg=errmsg+"<li>没有选定参数</li>"
end if
sub newsoft()
sql="select * from article where (articleid is null)"
rs.open sql,conn,1,3
rs.addnew
rs("title")=title
rs("content")=content
rs("ip")=ip
rs("qq")=qq
rs("email")=email
rs("hits")=0
if request.form("writer")<>"" then
rs("writer")=trim(request.form("writer"))
end if
if request.form("qq")<>"" then
rs("qq")=trim(request.form("qq"))
end if
if request.form("email")<>"" then
rs("email")=trim(request.form("email"))
end if
if request.form("writefrom")<>"" then
rs("writefrom")=trim(request.form("writefrom"))
end if
rs("dateandtime")=date()
rs.update
articleid=rs("articleid")
end sub
sub editsoft()
sql="select * from article where articleid="&request("id")
rs.open sql,conn,1,3
rs("title")=title
rs("content")=content
rs("ip")=ip
if request.form("writer")<>"" then
rs("writer")=trim(request.form("writer"))
end if
if request.form("writefrom")<>"" then
rs("writefrom")=trim(request.form("writefrom"))
end if
rs.update
articleid=rs("articleid")
end sub

rs.close
set rs=nothing
conn.close
set conn=nothing
%>
<html>

<head>
<title></title>
<STYLE type=text/css>
TD {
FONT-SIZE: 12px;
FONT-FAMILY: "Verdana", "Arial", "Helvetica", "sans-serif";
}
A:active {
COLOR: #FFFFFF; TEXT-DECORATION: none
}
A:visited {
COLOR: #455164; TEXT-DECORATION: none
}
A:hover {
COLOR: #FFFFFF; TEXT-DECORATION: none
}
A:link {
COLOR: #FFFFFF; TEXT-DECORATION: none
}
</STYLE>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"></head>

<body background="image/bg.gif">
<div align="center"><center>
<br><br>
<table width="50%" border="0" align=center cellpadding="4" cellspacing="1" bordercolor="#999999" bgcolor="#CCCCCC">
<tr align=center>
<td width="100%" height="20" bgcolor="#f7f7f7" class="font"><b> <font color="#333333">
<%if request("action")="add" then%>
添加
<%else%>
修改
<%end if%>
文章成功</font></b></td>
</tr>
<tr>
<td bgcolor="#FFFFFF" class="font">
<p align="left"><br>
<font color="#333333">文章序号为:
<%response.write "article"&articleid%>
<br>
文章名称为:
<%response.write title%>
</font></p>
<font color="#333333">您可以<a href='/bbs'><font color="#FF0000">返回</font></a>进行其他操作 </font></td>
</tr>
</table>
</center></div>
<%
else
Error()
end if
%>

</body>
</html>
<%
sub Error()
response.write " <html><head><link rel='stylesheet' href='style.css'></head><body>"
response.write " <br><br><br>"
response.write " <table align='center' width='300' border='0' cellpadding='4' cellspacing='0'>"
response.write " <tr > "
response.write " <td class='title' colspan='2' height='15'> "
response.write " <div style='FONT-SIZE: 12px' align='center'>由于以下的原因不能保存数据!</div>"
response.write " </td>"
response.write " </tr>"
response.write " <tr> "
response.write " <td align=center colspan='2' height='23'> "
response.write " <div style='FONT-SIZE: 12px'>"
response.write errmsg& " <br>"
response.write " <a href='javascript:onclick=history.go(-1)'>返回</a>"
response.write " </div><br></td>"
response.write " </tr> </table></body></html>"
end sub
%>

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧