The final display is like this:
User: billy Permissions: Administrator Time [January 21, 2004 20:54:08] Stay [0 hours 0 minutes] Idle [0 minutes 12 seconds]
Displayed BOTTOM.HTM file
<SCRIPT language =JavaScript>
<!--
function bar()
{
var oXMLDoc = new ActiveXObject('MSXML'); //Create 'MSXML' object
sURL = "loginxml.asp" //Get the address of login status data
oXMLDoc.url = sURL; //Load data
var oRoot=oXMLDoc.root ; //Get the root node of the returned xml data
if(oRoot.children != null)
{
//Display on the client based on the returned data
user.innerHTML=oRoot.children.item(0).text; //User
myclock.innerHTML=oRoot.children.item(1).text; //Time
stay.innerHTML= oRoot.children.item(2).text; //Stay
free.innerHTML=oRoot.children.item(3).text; //Free
qx.innerHTML=oRoot.children.item(4).text; //Permissions
}
if (oRoot.children.item(5).text>1800) //If the idle time exceeds 30 minutes, it will automatically go to the exit login page.
window.parent.location="/user/logoff.asp?id=1";
timeoutid = setTimeout("bar()",1000) //Get data every second,}
//-->
</SCRIPT>
User: <font color="#FF0000"><span id=user></span></font> Permissions: <font color="#FF0000"><span id=qx></span> </font> time [<span id=myclock></span>] stay [<span id=stay></span>] free [<span id=free></span>]
ASP page that provides XML data LOGINXML.ASP
<%
username=session("userName")
qxdm=session("qxdm")
set rs = server.createobject("adodb.recordset")
rs.source = "select * from userlogin where username='"&username&"'"
rs.open rs.source,conn,1,1
logindate=rs("logindate")
active=rs("active")
rs.close
stay=DateDIff("s",logindate,now())
off=DateDIff("s",active,now())
stay=stay/60
stay=Int(stay/60)&"hour"&Int(stay mod 60)&"minute"
free=Int(off/60)&"minutes"&Int(off mod 60)&"seconds"
us=DatePart("yyyy",date)&"year"&DatePart("m",date)&"month"&DatePart("d",date)&"day"&time
%>
<?xml version="1.0" encoding="gb2312" ?>
<plan>
<user><%=username%></user>
<date><%=us%></date>
<active><%= stay%></active>
<free><%=free%></free>
<qx><%call qx(qxdm)%></qx>
<off><%=off%></off>
</plan>
I originally thought that this would take up a lot of resources, but when I put it into practice, everything seemed fine.