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

在线用户显示问题!
表中主要字段:用户名(username),登入时间(intime),退出时间(outtime)。是否在线(isonline,true为在线,False为不在线),   sessionid(sess)

这是我的登入页面
<%
set   conn=opendb( "oabusy ", "conn ", "accessdsn ")
username=request( "username ")
password=request( "password ")
ip=request.servervariables( "REMOTE_ADDR ")
intime=now()‘登入时间
session( "useronline ")= "true "
sessionID   =   session.SessionID
session.Timeout=5
timeout   =session.Timeout

set   rs=server.createobject( "adodb.recordset ")
sql= "select   *   from   userinf   where   username= "   &   sqlstr(username)   &   "   and   password= "   &   sqlstr(password)   &   "   and   forbid= 'no ' "
rs.open   sql,conn,1,1
'
'如果有此用户就进入系统

if   not   rs.eof   and   not   rs.bof   then
'===============================================记录在线用户
set   rs1=server.CreateObject( "adodb.recordset ")
str= "select   *   from   user_online   where   sess= ' "   &   sessionID   &   " ' "
rscheck=conn.execute   (str)
if     rscheck.eof   then
sql= "insert   into   user_online   (userid,intime,ip,online,sess)values( ' "&username& " ', ' "&intime& " ', ' "&ip& " ', ' "&session( "useronline ")& " ', ' "&sessionid& " ') "
conn.Execute   (sql)
‘这里意思有用户进入系统时,自动清除表中、登入时间小于timeout(问题也就出现在这,并没有执行)
aaa   =   dateadd( "n ",   -timeout,   now())
conn.Execute   ( "update   online_user   set   online= 'false '   where   intime   <   # "   &   aaa   &   "# ")
rscheck.close
set   rscheck   =   nothing
end   if
  '=============================================  

%>
帮看看问题出现在哪

------解决方案--------------------