[求助]为什么总是显示类型不匹配?是什么原因??
我作的考勤登录,原来能登录,但不能限制重复登录,我重新增加了判断Iswork的函数来限制重复登录后,却总是显示错误类型:Microsoft VBScript 运行时错误 (0x800A000D)
类型不匹配: '[string: "username"]'
,到底错哪儿了?请各位前辈高人帮看看,代码如下:
<%
Response.Expires = 0 'expires属性指定了在浏览器上缓冲存储的页距过期还有多少时间。设置response.expires=0,则使缓存的页面立即过期。
Function checkenter() '判断是否有非法输入
If username<>"" and password<>"" and otherpwd<>"" and Instr(username,"'")<1 and Instr(username," ")<1 and Instr(username,"""")<1 and Instr(username,"&")<1 then
checkenter=TRUE '允许进行用户验证
Else
checkenter=FALSE '不允许进行用户验证
End If
End Function
Function checksysUser() '系统用户验证
sql="SELECT * FROM fdb_man WHERE user='"&username&"'"
Set rs=Server.CreateObject("adodb.recordset")
rs.Open sql,conn,1,1
if rs.eof then
checksysUser=FALSE
Session("passed")=False
else
passwd=trim(rs("pwd"))
if passwd=password then
checksysUser=TRUE
Session("passed")=True
Session("level")=rs("level")
Session("admin")=rs("admin")
else
checksysUser=FALSE
Session("passed")=False
end if
End if
End Function
Function checksysIswork() '用户登录检查
Set rs=Server.CreateObject("adodb.recordset")
sql = "select * from kaoqing_table"
rs.Open sql,conn,1,1
if rs.eof then
checksysIswork=FALSE
else
username="username"and recordYear="&Year(Now())&"and recordMonth="&Month(Now())&"and recordDay="&Day(Now())&"and Iswork="&Iswork&"
if Iswork=0 then
checksysIswork=TRUE
else
checksysIswork=FALSE
end if
End if
rs.close
conn.close
End Function
%>
<HTML>
<HEAD>
<TITLE>用户分级登录、有效性验证</TITLE>
<script language="VBScript">
<!--
Sub login_OnClick
Dim msg
msg = ""
If fus.stxm.value = "" Then
msg = "姓名不能为空!请先选择..."
fus.stxm.focus
End If
If msg = "" Then
fus.submit
ElseIf fus.pwd.value = "" Then
msg = "密码不能为空!请先输入..."
fus.stid.focus
ElseIf Len(fus.pwd.value) < 4 Or _
Not IsNumeric(fus.pwd.value) Then
msg = "密码由4位数字组成!请修改..."
fus.pwd.focus
Else
Alert(msg)
End If
End Sub
Sub reset_OnClick
fus.pwd.value = ""
fus.stxm.value = ""
fus.pwd.focus
End Sub
-->
</script>
</HEAD>
<BODY bgColor=#FFFFFF topMargin=0 leftmargin="0" onload="return window_onload()">
<p align="center"><b><font size="6" color="#6699FF">发电部考勤系统欢迎你登录</font></b></p>
<%
if Request.Form("action")="true" then
recordtime=trim(request.form("Now"))
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 and checksysIswork=true Then
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
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
%>
[[italic] 本帖最后由 林中泉水 于 2008-1-3 10:11 编辑 [/italic]]