cookie判断用户是否登录问题
登录时已经写入cookie的值
Response.Cookies(CookieName)("UserName") = CodeCookie(rs("UserName")) 用户名
Response.Cookies(CookieName)("Vid") = rs("UserID") 用户id
Response.Cookies(CookieName)("UserHashKey") = HashKey 随机密码
<%
'判断用户是否登陆
Dim tempUserID,tempHashKey,tempUserName
Dim UserID,UserName,UserHashKey
tempUserID=trim(Request.Cookies(CookieName)("Vid")) 能够取出
tempHashKey=CheckStr(Request.Cookies(CookieName)("UserHashKey")) 能够取出
tempUserName=CheckStr(DecodeCookie(Request.Cookies(CookieName)("UserName"))) 能够取出
If tempUserName<>"" And tempHashKey<>"" And tempUserID<>"" Then
Set rs=server.CreateObject("adodb.recordset")
sql="select UserHashKey from User where UserID='"&tempUserID&"' and UserName='"&tempUserName&"'"
rs.open sql,conn,1,1
if not rs.eof then
UserHashKey=rs(0)
rs.close
set rs=Nothing
If UserHashKey=tempHashKey Then
UserID=tempUserID
UserName=tempUserName
Else
UserID=""
UserName=""
End If
End If
End If
%>
问题是:
无论是否登录,UserID UserName的值都无法判断,请问这是怎么回事,是否查询语句有问题?