[求助]条件语句为何不起作用,究竟是什么原因??
我所编写的考勤登录系统,想用recordYear、recordMonth、recordDay=、Iswork的值限制重复登录,用条件语句提取数据表中的值 If Iswork=0 则,登录并记录考勤Iswork=1,否则,显示你已经登录。但条件语句似乎不起作用,同一用户总是能重复登录,想请各位前辈高手看看。代码如下:<%
if Request.Form("action")="true" then
username=trim(Request.Form("username")) '登录用户名
password=trim(Request.Form("password")) '登录密码
otherpwd = Trim(Request.form("otherpwd")) '附加码
reotherpwd = Trim(Request.form("reotherpwd"))'生成的附加码
legalTag=checkenter()
If legalTag=TRUE then '如果没有非法输入,则进行用户验证
if otherpwd = reotherpwd then '附加码比较
legalUserTag=checksysUser() '系统用户验证
if legalUserTag=true then
If Session("level")=1 and Session("admin")="True" Then
Response.Redirect("manage.asp")
Response.End
End If
If Session("level")=2 Then
Response.Redirect("main.asp")
Response.End
End If
If Session("level")=3 Then
Sql="SELECT * FROM kaoqing_table WHERE user='"&username&"' and recordYear=Year(Now()) and recordMonth=Month(Now()) and recordDay=Day(Now())" '提取表中本年本月本日的Iswork值。
If Iswork=0 Then '如果Iswork=0,则登录并记录登录年月日及时间
set rs=server.createobject("adodb.recordset")
insertsql="select * from kaoqing_table"
rs.open insertsql,db,1,3
rs.addnew
rs("user")=username
rs("recordYear")=Year(Now())
rs("recordMonth")=Month(Now())
rs("recordDay")=Day(Now())
rs("recordTime")=Time
rs("Iswork")=1
rs("note")=note
rs.update
rs.close
set rs=nothing
Response.Redirect("normal.asp")
Response.End
else '否则说明你已登录过了
Response.write "你已登录过了"
End If
End If
else
errmsg="<font color=#FF0000><b>用户名或者用户密码错误,请重新输入!</b></font>"
end if
else
errmsg="<font color=#FF0000><b>附加码输入错误,请重新输入!</b></font>"
end if
else
errmsg="<font color=#FF0000><b>用户名输入有误,请重新输入!</b></font>"
end if
end if
%>