太长了吧,不过实用.正好我也想用,省了我写了.谢谢
<%
admin=request.form("admin")
password=request.form("password")
yyy=request("yyy") '这里是接收验证码框传来的数据!
hhh=request("hhh") '这里是接收隐藏区域传来的随机生成的验证码!
if admin="" or password="" then
response.write("<script language=javascript>alert('请填写完整');history.go(-1)</script>")
end if
sql="select * from admin where admin='"&admin&"' and password='"&password&"'"
set rs=conn.execute(sql)
if rs.eof or rs.bof then
response.write "<script language=javascript>"
response.write "alert('用户或密码不对!');"
response.write "javascript:history.go(-1);"
response.write "</script>"
else if yyy<>hhh then
response.write "<script language=javascript>"
response.write "alert('你输入的验证码与系统产生的不一致,请重新输入!');"
response.write "javascript:history.go(-1);"
response.write "</script>"
response.end()
else
session("admin")=admin
session("userClass")=1
response.redirect "manage.asp"‘进入管理页面
%>
<%
end if
end if
%>
-----------------以下这段代码就是你把它加入到登录页面--------------------
<input type="hidden" name="hhh" value="<%=session("SID")%>">