投票提交保存

keyskyer 2008-07-10 10:01:58
<%
if kid=6 and tit<>"" and vote="" then
response.write "<script>alert('您还没有选择一项,不能进行投票!');top.history.back();</script>"
response.end
end if
if kid=6 and tit<>"" and vid>0 and vote<>"" then
sqlv="select * from vode where cid="&vid
set rsv=server.createobject("adodb.recordset")
rsv.open sqlv,conn,1,3
if not rsv.eof then
do while not rsv.eof
if isdate(rsv("edtime"))=False then rsv("edtime")=rsv("udtime")
if datediff("s",rsv("edtime"),now())<=1 then
response.write "<script>alert('您的投票请求过快,已被系统阻止!');window.history.back();</script>"
response.end
else
response.write rsv("cid")&"&#nbsp;"&rsv("vote")&"&#nbsp;"&rsv("eip")&"<BR>"
response.write vid&"&#nbsp;"&vote&"&#nbsp;"&ip_my
if rsv("vote")=vote and rsv("eip")=ip_my then
rsv("edtime")=now()
else
rsv.addnew
rsv("aid")=kid
rsv("cid")=vid
rsv("vote")=vote
rsv("eip")=ip_my
rsv("iip")=ip_mn
rsv("udtime")=now()
end if
if rsv("title")<>tit then rsv("title")=tit
rsv("hit")=rsv("hit")+1
if others<>"" then rsv("others")=others
rsv.update
response.write "<script>"&vbcrlf&"alert('恭喜您,成功为“"&rsv("title")&"”投了一票!');"&vbcrlf&"window.history.back

();"&vbcrlf&"</script>"
end if
rsv.movenext
loop
else
rsv.addnew
rsv("aid")=kid
rsv("cid")=vid
rsv("vote")=vote
rsv("eip")=ip_my
rsv("iip")=ip_mn
rsv("udtime")=now()
rsv("title")=tit
rsv("hit")=1
if others<>"" then rsv("others")=others
rsv.update
response.write "<script>"&vbcrlf&"alert('哇~~~您是“"&rsv("title")&"”的第一位投票者耶!谢谢哦

~~');"&vbcrlf&"window.history.back();"&vbcrlf&"</script>"
end if
response.end
end if%>


当我第一次投票的时候就提交一条数据,
同一个cid再多次提交其他选项的时候,无论eip和vote是不是都相等都会被添加好多条,怎么回事呢?
...全文
90 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
keyskyer 2008-07-11
  • 打赏
  • 举报
回复
那么如何终止呢?
难道在输出script后再加句response.end么?
msd88 2008-07-11
  • 打赏
  • 举报
回复
if rsv("vote")=vote and rsv("eip")=ip_my then
rsv("edtime")=now()
else
rsv.addnew
rsv("aid")=kid
rsv("cid")=vid
rsv("vote")=vote
rsv("eip")=ip_my
rsv("iip")=ip_mn
rsv("udtime")=now()
end if

你这里虽然做了判断,但还是有更新的,并没有终止程序
keyskyer 2008-07-11
  • 打赏
  • 举报
回复
填写页面的代码(放在do while...loop循环里面):
<form name=form6 method=post action="?id=<%=kid%>&vid=<%=rs("id")%>&tit=<%=rs("title")%>">
<input type=radio name=vote value=`0`>第一项
<input type=radio name=vote value=`1`>第二项
<input type=radio name=vote value=`2`>第三项
<input class=inv type=text name=others value=``>其他
<input type=submit value=`提交` class=buttom>
</form>
keyskyer 2008-07-11
  • 打赏
  • 举报
回复
算了,难度实在太大了, 不搞了.结帖去了..
keyskyer 2008-07-10
  • 打赏
  • 举报
回复
这是提交后判断的的代码呀
msd88 2008-07-10
  • 打赏
  • 举报
回复
问题没讲清,代码好象不全,没有缩进,看着乱。
tantaiyizu 2008-07-10
  • 打赏
  • 举报
回复
when happened this question ,cos the program go to else .

so check your if block and care the "response.end".
keyskyer 2008-07-10
  • 打赏
  • 举报
回复
咋没人来帮忙下捏?

28,391

社区成员

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

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