ASP求大神帮我看看问题出在哪里了!
asp 看代码,如果条件不符合都正确提示,可如果所有条件都符合,它反过来会提示“必填项目不能为空”<!--#include file="conn.asp"-->
<%
if(request("action")="yes") then
uid=request("uid")
upass=request("upass")
yaoq=request("yaoq")
uemail=request("uemail")
if uid="" or upass="" or yaoq="" or uemail="" then
Response.write "<SCRIPT language=JavaScript>alert('必填项目不能为空!');history.go(-1);</SCRIPT>"
end if
Set rs1= Server.CreateObject("ADODB.Recordset")
SQL="Select * from [ACC] where FLD_ID='"&uid&"'"
rs1.open SQL,conn,1,3
if rs1.eof or rs1.bof then
rs1.close
Response.write "<SCRIPT language=JavaScript>alert('账户不存在,请重新输入!');history.go(-1);</SCRIPT>"
Response.End
else
if rs1("PASSWORD")<>upass then
rs1.close
Response.write "<SCRIPT language=JavaScript>alert('密码错误,请重新输入!');history.go(-1);</SCRIPT>"
Response.End
end if
if rs1("Mail")<>uemail then
rs1.close
Response.write "<SCRIPT language=JavaScript>alert('邮件错误,请重新输入!');history.go(-1);</SCRIPT>"
Response.End
end if
if rs1("VIP")<>"0" then
rs1.close
Response.write "<SCRIPT language=JavaScript>alert('您不符合条件,不能使用该邀请码!');history.go(-1);</SCRIPT>"
Response.End
end if
Set rs2= Server.CreateObject("ADODB.Recordset")
SQL2="Select * from [yqm] where nb='"&yaoq&"'"
rs2.open SQL2,conn,1,3
if rs2.eof or rs2.bof then
rs2.close
rs1.close
Response.write "<SCRIPT language=JavaScript>alert('该邀请码不存在或已被使用!');history.go(-1);</SCRIPT>"
Response.End
else
rs1.addnew
rs1("YAOQINGMA")=yaoq
rs1("VIP")="1"
rs1("VIPTIME")= DateAdd("m", 1,date()) + time()
rs1.update
sql2= "delete from [yqm] where id=(select id from [yqm] where nb='"&yaoq&"')"
conn.execute sql2
rs2.close
end if
set rs2=nothing
rs1.close
Response.write "<SCRIPT language=JavaScript>alert('使用成功!');history.go(-1);</SCRIPT>"
end if
set rs1=nothing
end if
%>
非常奇怪,如果表单提交的数据不符合规则,那么那些alert('.....!')
如:【密码错误,请重新输入!、您不符合条件,不能使用该邀请码!、该邀请码不存在或已被使用!】都可以正常出来!
反过来如果所有条件符合,他却不执行写入与删除,却又返回去执行 【 alert('必填项目不能为空!')】这个,我把这个判断去掉,他就执行【alert('账户不存在,请重新输入!');】
到底问题出在哪里,