Tutorials to .com

Tutorials to .com » Asp » Xml » Made at any time without refreshing the current server time users landing time, online time, idle time and automatically from the example of

Made at any time without refreshing the current server time users landing time, online time, idle time and automatically from the example of

Print View , by: iSee ,Total views: 7 ,Word Count: 631 ,Date: Wed, 22 Apr 2009 Time: 3:49 AM

Final show is this:

User: billy permissions: administrator time [January 21, 2004 20:54:08] stay [0 hours 0 minutes] free [0 minutes 12 seconds]

BOTTOM.HTM documents show

<SCRIPT Language=JavaScript>
<! --
function bar ()
(

var oXMLDoc = new ActiveXObject ( 'MSXML'); / / create 'MSXML' object

sURL = "loginxml.asp" / / to obtain the address of landing state data

oXMLDoc.url = sURL; / / load data

var oRoot = oXMLDoc.root; / / obtain the root node to return xml data
if (oRoot.children! = null)

(


/ / According to the data returned to the client display

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) / / idle time more than 30 minutes will automatically go from the landing page
window.parent.location = "/ user / logoff.asp? id = 1";


timeoutid = setTimeout ( "bar ()", 1000) / / no one seconds to obtain a data)
//-->
</ 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>]


xml data provided by asp page 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) & "hours" & Int (stay mod 60) & "minutes"
free = Int (off/60) & "minutes" & Int (off mod 60) & "seconds"
us = DatePart ( "yyyy", date) & "years" & DatePart ( "m", date) & "on" & DatePart ( "d", date) & "days" & 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>


Thought that it would occupy a lot of resources, but the actual application of that normal



Asp and XML related Articles


Can't Find What You're Looking For?


Rating: Not yet rated

Comments

No comments posted.