日期:2014-05-17  浏览次数:20792 次

第一次输入用户名和密码登录后以后就自动登录
我有一OA系统,每次进入系统都要输入用户名和密码,能否第一次输入后只要不删除cookies就永久自动登录。下面是登录页面的代码:
<!--#include file="conn.asp"-->
<!--#include file="MD5.ASP"-->
<!--#include file="inc\config.ASP"-->
<%
session.Timeout=20
dim user,psw,manage
user=trim(request("user"))
psw=md5(trim(request("psw")))
if user<>"" and psw<>"" then
dim rs_u
dim sql_u
dim count
set rs_u=server.createobject("adodb.recordset")
sql_u = "select * from [acuser] where ac_user='" & user & "' and ac_psw='" & psw & "'"
rs_u.open sql_u,conn,1,1
if rs_u.eof and rs_u.bof then
else
session("ac")="true"
session("ac_userid")=rs_u("id")
session("ac_item")=rs_u("ac_item")
session("ac_type")=rs_u("ac_type")
response.Redirect "ac_v.asp"
end if
end if
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>建湖教育系统公文系统登录</title>
<link href="STYLE6.CSS" rel="stylesheet" type="text/css">
</head>

<body oncontextmenu="return false">
<form name="form1" method="post" action="login.asp">
  
  <p align="center">&nbsp;</p>
  <br>
  <table width="560" height="300" border="0" align="center" cellspacing="0" background="image/login1.jpg" class="border">
  <tr> 
  <td width="560" height="110" align="right" valign="bottom"><table width="100%" height="24" bgcolor="#CCFFFF" border="0">
  <tr>
  <td width="20%"><div align="right">用户名:</div></td>
  <td width="21%"><div align="center">
  <input name="user" type="text" id="user" size="12">
  </div></td>
  <td width="10%"><div align="right">密码:</div></td>
  <td width="18%"><div align="center">
  <input name="psw" type="password" id="psw" size="12">
  </div></td>
  <td width="31%">
  <div align="left">
  <input type="submit" name="Submit" value="登录">
  </div></td>
  </tr>
  </table></td>
  </tr>
  </table>
  <p align="center"><font size="2">版权所有 Copyright @ <%=SiteTitle%> 2006.7</font></p>
  <p align="center"><font size="2"> 公文流转维护:&nbsp;<%=WebmasterName%></font></p>
  
</form>
</body>
</html>


------解决方案--------------------
设置cookie的生命周期
------解决方案--------------------
你这个代码里也没有用的到COOKIES呀。。。
------解决方案--------------------
<%
Response.Cookies("logintoken")="jdajds