大家帮忙看看这段代码为什么会不行
代码如下:
我的要求是先验证码比对,如果不对就刷新,现在我如果帐号密码对,就算不输入验证码,程序也能进入下一页面,这是为什么??
<!--#include file=include/config.asp-->
<!--#include file=conn_view.asp-->
<!--#include file=include/function.asp-->
<!--#include file=include/md5.asp-->
<%
dim user,password,strSql,rsTmp,retValue
user=request("username")
password=request("Passw")
if Session("Getcode")<>request("ValidCode") then
%>
<SCRIPT LANGUAGE=vbscript>
<!--
msgbox("验证码不正确!")
window.top.location.href="index.asp"
-->
</SCRIPT>
<%
end if
if request("username")="" then
%>
<SCRIPT LANGUAGE=vbscript>
<!--
msgbox("用户名不能为空!")
window.top.location.href="index.asp"
-->
</SCRIPT>
<%
end if
if password="" then
%>
<SCRIPT LANGUAGE=vbscript>
<!--
msgbox("密码不能为空!")
window.top.location.href="index.asp"
-->
</SCRIPT>
<%
end if
set rsTmp=Server.CreateObject("ADODB.RecordSet")
strSql = "select * from [admin] where username='" & convertsql(user) & "'"
'password=md5(password,16)
strSql = strSql & " and pass_wd='" & convertsql(password) & "'"
rsTmp.open strSql,conn,1,1
if rsTmp.eof then
retValue=1
%>
<script>alert("用户名或密码错误,请返回!!!");history.go(-1);</script>
<%
else
retValue=0
'##设置session
session("zjlogin")=""
session("userlogin")="ok"
'session("adminlogin")="ok"
session("user_id")=rsTmp("user_id")
session("user_name")=rsTmp("username")
'rsTmp("last_date")=now()
'rsTmp.update
end if
rsTmp.close
set rsTmp=nothing
conn.close
set conn=nothing
'##跳转到另一页去
if retValue=0 then
response.redirect "jiaofei.asp"
end if
%>
|