顯示用戶是否在線的方法
發(fā)表時(shí)間:2024-05-23 來(lái)源:明輝站整理相關(guān)軟件相關(guān)文章人氣:
[摘要]check.asp <script language=javascript> function Test() var xmlhttp = new ActiveXObject("MSXML2.XMLHTTP"); xmlhttp.open("POST&qu...
check.asp
<script language=javascript>
function Test()
{
var xmlhttp = new ActiveXObject("MSXML2.XMLHTTP");
xmlhttp.open("POST","online.asp",false); // 向onceonline.asp發(fā)送更新請(qǐng)求
xmlhttp.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded");
xmlhttp.send();
}
setInterval("Test();",10); // 10秒鐘發(fā)送一次更新請(qǐng)求
</script>
online.asp
<!--#include file="conn.asp"-->
<%
conn.Execute "update hand_us set i='"&ii&"' where h=true and a='"&request.cookies("login_hand")&"'" '更新最后在線時(shí)間
conn.Execute "update hand_us set h=false where datediff('s',i,now())>1" '刪除不在線的用戶
enddata()
%>