首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > ASP >

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

2012-02-26 
如何设置有效时间内自动删除不活动的在线用户名单如果用户不正常退出一直保留在名单上面,如何设置有效时间

如何设置有效时间内自动删除不活动的在线用户名单
如果用户不正常退出一直保留在名单上面,如何设置有效时间内自动删除不活动(或没正常退出)的在线用户名单?不知如何实现?实时刷新的文件代码如下:
<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


newsd(49)=line+1
newsd(50)= "parent.getmsg( ' "&dv_user(0)& " ', '大家 ', '对 ', '【公告】 <a   href=javascript:parent.seluser(\ ' "&dv_user(0)& "\ ');   target=f2> "&dv_user(0)& " </a> 如风一样飘进了『千寻八度』聊天中心! <bgsound   src=type.wav   loop=1> ', '2 ', 'AA00CC ', 'AA00CC ', '0 ', ' "&time()& " ');   "
Application( "chat_sd ")=newsd
Application.UnLock
end   if
'dv_user(1)=Application( "chat_line ")
dv_user(3)=1
session( "dv_user ")=dv_user
end   if
ph   =   Request.ServerVariables( "SCRIPT_NAME ")
ph   =   Left(ph,   Len(ph)   -   8)
Response.Expires=300
%>
如果正常退出是实时的,没正常退出的(或未活动的)实现在3分钟内自动删除该用户,有谁能帮我看代码如何改?谢谢

[解决办法]
Just create one.

热点排行