COOKIE应用出了问题

来源:百度知道 编辑:UC知道 时间:2024/06/05 08:31:30
帮忙看下哪个地方有问题啊???
<!--#include file="conn.asp"-->
<%
username=request.form("username")
password=request.form("password")
set rs=server.createobject("adodb.recordset")
sql="select * from data where username='"&username&"'and password='"&password&"'"
rs.open sql,conn,1,1
if username="" then
response.write "<script>alert('请输入用户名和密码!!!');history.back();</script>"
response.end
end if
if rs.eof then
response.write "<script>alert('登录失败');history.back();</script>"
response.end
end if
if rs("password")<>password then
response.write "<script>alert('登录失败');history.back();</script>"
response.end
end if
if request.cookies("loginalready")="1" th

也不知道你具体遇到什么问题了。wmycom可能没看清你的代码,你的代码思路基本是正确的,不过也有些问题。我修改了一下:
<!--#include file="conn.asp"-->
<%
username=request.form("username")
password=request.form("password")

'判断用户输入信息
if username="" or password="" then
response.write "<script>alert('请输入用户名或密码不能为空');history.go(-1);</script>"
response.end
end if

'数据集
set rs=server.createobject("adodb.recordset")
sql="select * from data where username='"&username&"'and password='"&password&"'"
rs.open sql,conn,1,1

'无相应记录
if rs.eof then
response.write "<script>alert('不存在此用户');history.go(-1);</script>"
response.end
end if

'密码对应
if rs("password")<>password then
response.write &quo