注册 登录
编程论坛 ASP技术论坛

设定cookies时间无效,浏览器关闭无效,手动清除缓存无效,求解

aaaa1111a1 发布于 2011-05-15 20:31, 467 次点击
我郁闷了,怎么弄用户的cookies还在,除非代码设定用户的cookies为空,求解啊,设定cookies时间无效,浏览器关闭无效,手动清除缓存无效,求解

代码如下:

 

<!--#include file="conn.asp"-->
<!--#include file="func.asp"-->

<!--#include file="sql.asp"-->
<%dim admin,password

admin=FormatSQL(replace(trim(request.form("admin")),"'",""))
password=md5(FormatSQL(replace(trim(request.Form("password")),"'","")))
passcode=request.form("passcode")
if passcode="" then
response.Write "<script LANGUAGE='javascript'>alert('登录失败!请输入您的验证码!');window.location.href='admin_login.asp';</script>"
response.end
end if
passcode=Cint(request.form("passcode"))
if passcode<>Session("GetCode") then
response.Write "<script LANGUAGE='javascript'>alert('登录失败!验证码错误!');window.location.href='admin_login.asp';</script>"
response.end
end if

set rs=server.CreateObject("adodb.recordset")
sql="select * from [admin] where admin='"&admin&"' and password='"&password&"' "
'response.write sql
rs.open sql ,conn,1,1
if rs.bof and rs.eof then
response.write "<script LANGUAGE='javascript'>alert('你的用户名或者密码错误,登录失败!');window.location.href='admin_login.asp';</script>"
else
if password=rs("password") and admin=rs("admin") then
response.Cookies("huiboshop")("admin")=trim(rs("admin"))
response.Cookies("huiboshop")("rank")=int(rs("rank"))
response.Cookies("huiboshop").Expires=now+1/1440
rs.Close
set rs=nothing
conn.Close
set conn=nothing
response.Redirect "index.asp"
else
response.write "<script LANGUAGE='javascript'>alert('你的密码错误,登录失败!');window.location.href='admin_login.asp';</script>"
end if
end if
%>
 
1 回复
#2
dzt00012011-05-15 22:06
你的代码时设置了cookies有效期是一分钟,一分钟后应该会失效。
cookies与关不关浏览器没有关系,如果用浏览器的清除cookies后还存在,那就是系统问题
1