当前位置: 代码迷 >> ASP >> 怎么设置有效时间内自动删除不活动的在线用户名单
  详细解决方案

怎么设置有效时间内自动删除不活动的在线用户名单

热度:208   发布时间:2012-02-26 20:19:44.0
如何设置有效时间内自动删除不活动的在线用户名单
如果用户不正常退出一直保留在名单上面,如何设置有效时间内自动删除不活动(或没正常退出)的在线用户名单?不知如何实现?实时刷新的文件代码如下:
<meta   http-equiv= "refresh "   content= "5 ">  
<%
online=Application( "onlinelist ")
online=split(online, "   ")
Response.Write   " <script   language=javascript> parent.f6.document.open(); "
Response.Write   "var   winbgcolor   =   parent.cbg();var   winbgimage   =   parent.cbi(); "
Response.Write   "parent.f6.document.writeln( " " <body   bgcolor= " "   +   winbgcolor   +   " "   background= " "   +   winbgimage   +   " "   bgproperties=fixed   > " "); "
Response.Write   "parent.f6.document.writeln( " " <style   type= 'text/css '> A:visited{TEXT-DECORATION:   none;Color:#000000}A:active{TEXT-DECORATION:   none;Color:#000000}A:hover{TEXT-DECORATION:   underline;Color:#000000}A:link{text-decoration:   none;Color:#000000}BODY{FONT-FAMILY:   '宋体 ';   FONT-SIZE:   12px;} </style> " "); "
if   ubound(online)=-1   then
Response.Write   "msg= ' <a   href=javascript:parent.seluser(\ '大家\ ');   target=f2> 大家 </a> <br> ';parent.f6.document.writeln( '当前在线(   0   )人 <br> '); "
else
Response.Write   "msg= ' <a   href=javascript:parent.seluser(\ '大家\ ');   target=f2> 大家 </a> <br> ';parent.f6.document.writeln( '当前在线(   "&ubound(online)& "   )人 <br> '); "
end   if
for   i=lbound(online)   to   ubound(online)-1
Response.Write   "msg=msg+ ' <a   href=javascript:parent.seluser(\ ' "&online(i)& "\ ');   target=f2> "&online(i)& " </a> <br> '; "
next
Response.Write   "parent.f6.document.writeln(msg); "
Response.Write   " </script> "
%>

登录时初始数组代码如下:
<%
tmpname=request( "username ")
if   Application( "chat_line ")= " "   then  
  Dim   sd_init(50)
  for   i=1   to   48
  sd_init(i)=0
  next
  sd_init(49)=1
  sd_init(50)= "数组初化成功! "
  Application( "chat_sd ")=sd_init
  Application( "chat_line ")=1
Application( "onlinelist ")= " "
end   if
if   not   isarray(session( "dv_user "))   then  
dim   dv_user(3)
dv_user(0)=tmpname
dv_user(1)=Application( "chat_line ")
dv_user(2)=now()
dv_user(3)=0
session( "dv_user ")=dv_user
else
dv_user=session( "dv_user ")
end   if

if   Instr(LCase(Application( "onlinelist ")),LCase(dv_user(0)& "   "))=0   then
Application.lock
Application( "onlinelist ")=Application( "onlinelist ")&dv_user(0)& "   "
Application.UnLock
if   dv_user(3)=0   then
Application.lock
sd=Application( "chat_sd ")
line=int(Application( "chat_line "))
Application( "chat_line ")=line+1
Dim   newsd(50)
j=1
for   i=3   to   50   step   2
newsd(j)=sd(i)
newsd(j+1)=sd(i+1)
j=j+2
next
  相关解决方案