您的位置:首页 > Web前端 > JavaScript

显示用户是否在线的方法 选择自 cqhand 的 Blog

2005-01-12 16:38 393 查看
check.asp
  
<script language=javascript>
    function Test()
    {
    var xmlhttp = new ActiveXObject("MSXML2.XMLHTTP");
    xmlhttp.open("POST","online.asp",false);  // 向onceonline.asp发送更新请求
    xmlhttp.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded");
    xmlhttp.send();
    }
    setInterval("Test();",10); // 10秒钟发送一次更新请求
   </script>

online.asp

<!--#include file="conn.asp"-->
<%
conn.Execute "update hand_us set i='"&ii&"'  where h=true and a='"&request.cookies("login_hand")&"'"   '更新最后在线时间
conn.Execute "update hand_us set h=false  where datediff('s',i,now())>1" '删除不在线的用户
enddata()
%>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息