CSDN博客

img aspczlover

关闭窗口,立即注销登陆

发表于2004/10/2 4:08:00  781人阅读

分类: 常用代码

logout.asp是注销页面

<script for=window event=onbeforeunload>
if (event.clientX>document.body.clientWidth &&event.clientY<0||event.altKey)
{
//return("确实要关闭窗口1?");
closesystem();
}

function closesystem()
{   
 window.open('logout.asp?closeflag=0','closesystem','location=no,height=10, width=10, top=600, left=10,toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no');
}

</script>


logout.asp
主要用来清空session或cookie
并把application里此用户的在线信息清空
<%
oabusyusername=request.cookies("username")

response.cookies("userid")=""
response.cookies("username")=""
response.cookies("userlevel")=""


dim onlineuser
application.lock
onlineuser=application("onlineuser")
number=ubound(onlineuser)
if number>=0 then
 if number=0 then
  onlineuser(0)=""
  application("onlineuser")=onlineuser
 else
  for i=0 to number
   if instr(onlineuser(i),oabusyusername&"$")>0 then
    for j=i to number-1
     onlineuser(j)=onlineuser(j+1)
    next
    redim preserve onlineuser(number-1)
    application("onlineuser")=onlineuser
    exit for
   end if
  next
 end if
end if
application.unlock
%>

阅读全文
0 0

相关文章推荐

img
取 消
img