关于cookies相关问题
利用cookies自动登录代码如下:其中cookies密码我用MD5加密后和数据库中MD5段(MD5加密过的密码)对比正确就登录不正确就转到登录页面。问题1:当我修改数据库中MD5段后。正常来说应该是转到登录页面。但是却出现服务器错误404-找不到文件。问题2:我修改客户端cookies密码保存后。还是能自动登录。为什么呢。我有对比密码啊。
<% if request.cookies("name")<>""then '判断cookies是否为空,不为空就直接登录 dwg=cstr(request.cookies("name")) sql2="select * from admin where 用户名='"&dwg&"'" set rs2=server.CreateObject("adodb.recordset") rs2.open sql2,MM_conngongsi_STRING,1,3 if rs2.eof then '判断有无记录,如果没有记录就清空客户端cookies.有记录就自动登录 response.cookies("name")="" response.cookies("pass")="" response.Redirect "admin_longin.asp" response.end else sql3="select MD5 from admin where 用户名='"&dwg&"'" set rs3=server.CreateObject("adodb.recordset") rs3.open sql3,MM_conngongsi_STRING,1,3 if request.cookies("pass")=rs3("MD5") then '判断密码是否正确 Session("MM_Username")=cstr(request.cookies("name")) response.redirect "admin.asp" response.End else response.cookies("name")="" response.cookies("pass")="" response.Redirect "admin_longin.asp" response.end end if end if end if%>