晕,密码对与错都说密码错误
先拜个晚年,祝各位前辈狗年快乐
进入正题,呵呵,下面是代码,为什么验证密码时无论对与错都说错误呢??
谢谢
<!--#include file="../com/conn.asp"-->
<%
open_connection
dim txt_zj
dim txt_pw
txt_zj=request.Form("txt_zj")
txt_pw=request.Form("txt_pw")
if trim(txt_zj) &"x"="x" or trim(txt_pw) &"y"="y" then
response.Write("<script>alert('证件名或密码不能为空,请检查输入信息')</script>")
response.write ("<script>window.location='../main_index.asp'</script>")
else
dim strsql
dim rs
strsql="select * from usertb where user_num='"&txt_zj&"'"
set rs=server.CreateObject("adodb.recordset")
rs.open strsql,conn,3,3
if rs.recordcount=0 then
response.Write("<script>alert('无此证件号,请检查输入信息')</script>")
response.write ("<script>window.location='../main_index.asp'</script>")
elseif cstr(txt_pw)<>cstr(rs("user_password")) then
response.Write("<script>alert('密码错误,请检查输入信息')</script>")
response.write ("<script>window.location='../main_index.asp'</script>")
else
session("user_num")=txt_zj
session("user_password")=txt_pw
response.write ("<script>window.location='../main_index.asp'</script>")
end if
end if
%>
<%
open_connection
dim txt_zj
dim txt_pw
txt_zj=request.Form("txt_zj")
txt_pw=request.Form("txt_pw")
if trim(txt_zj) &"x"="x" or trim(txt_pw) &"y"="y" then
response.Write("<script>alert('证件名或密码不能为空,请检查输入信息')</script>")
response.write ("<script>window.location='../main_index.asp'</script>")
else
dim strsql
dim rs
strsql="select * from usertb where user_num='"&txt_zj&"'"
set rs=server.CreateObject("adodb.recordset")
rs.open strsql,conn,3,3
if rs.recordcount=0 then
response.Write("<script>alert('无此证件号,请检查输入信息')</script>")
response.write ("<script>window.location='../main_index.asp'</script>")
elseif cstr(txt_pw)<>cstr(rs("user_password")) then
response.Write("<script>alert('密码错误,请检查输入信息')</script>")
response.write ("<script>window.location='../main_index.asp'</script>")
else
session("user_num")=txt_zj
session("user_password")=txt_pw
response.write ("<script>window.location='../main_index.asp'</script>")
end if
end if
%>