%
'==============================================================
' TableEditoR 0.81 Beta
' http://www.2enetworx.com/dev/projects/tableeditor.asp
'--------------------------------------------------------------
' File: te_view_active_users.asp
' Description: Displays active TableEditoR users
' Initiated By Rami Kattan on Apr 10, 2002
'--------------------------------------------------------------
' Copyright (c) 2002, 2eNetWorX/dev.
'
' TableEditoR is distributed with General Public License.
' Any derivatives of this software must remain OpenSource and
' must be distributed at no charge.
' (See license.txt for additional information)
'
' See Credits.txt for the list of contributors.
'
' Change Log:
'--------------------------------------------------------------
'==============================================================
%>
<% Response.Buffer = true %>
<%
if not bAdmin then
response.write "Not authorized to view this page."
%><%
response.end
end if
set my_Conn = Server.CreateObject("ADODB.Connection")
my_Conn.Open arrConn(0)
nRefreshTime = Request.Form("RefreshTime")
%>
|
|
>
<%
if not bActiveUsers then %>
| Active Users not enabled... |
|
<%
response.end
end if
strSQL = "SELECT * FROM Active_Users"
set rs = my_Conn.Execute (strSQL)
if rs.EOF or rs.BOF then
%>
| No active users found |
<%
else
strActiveUsersRecordCount = 1
strActiveUsersI = 0
do until rs.eof
if strActiveUsersI = 0 then
strActiveUsersCColor = "#fffaf0"
else
strActiveUsersCColor = "#fffaf0"
end if
strActiveUsersUserID = rs("UserID")
strActiveUsersUserIP = rs("UserIP")
strActiveUsersPageViewing = rs("PageViewing")
strActiveUsersCheckedIn = rs("CheckedIn")
strActiveUsersLastCheckedIn = rs("LastCheckedIn")
strActiveUsersTotalOnlineTime = datediff("n", strActiveUsersCheckedIn, NOW)
If strActiveUsersTotalOnlineTime > 60 then
' they must have been online for like an hour or so.
strActiveUsersTotalOnlineHours = 0
do until strActiveUsersTotalOnlineTime < 60
strActiveUsersTotalOnlineTime = (strActiveUsersTotalOnlineTime - 60)
strActiveUsersTotalOnlineHours = strActiveUsersTotalOnlineHours + 1
loop
strActiveUsersTotalOnlineTime = strActiveUsersTotalOnlineHours & " Hours " & strActiveUsersTotalOnlineTime & " Minutes"
Else
strActiveUsersTotalOnlineTime = strActiveUsersTotalOnlineTime & " Minutes"
End If
strActiveUsersPageViewingOriginal = strActiveUsersPageViewing
strActiveUsersHTTPHost = Request.ServerVariables("HTTP_HOST")
strActiveUsersHTTPHost = "http://" & strActiveUsersHTTPHost
strActiveUsersPathLength = Len(strActiveUsersPageViewing) - (Len(strActiveUsersHTTPHost))
If instr(strActiveUsersPageViewing, strActiveUsersHTTPHost) Then
strActiveUsersPageViewing = Right(strActiveUsersPageViewing, strActiveUsersPathLength)
If Left(strActiveUsersPageViewing, 1) = "/" Then
strActiveUsersPageViewing = Right(strActiveUsersPageViewing, (Len(strActiveUsersPageViewing) - 1))
End If
End If
%>
| <%=strActiveUsersUserID%> |
<%=strActiveUsersPageViewing%> |
<%=strActiveUsersCheckedIn%> |
<%=strActiveUsersLastCheckedIn%> |
<%=strActiveUsersTotalOnlineTime%> |
<%
strActiveUsersRecordCount = strActiveUsersRecordCount + 1
strActiveUsersI = strActiveUsersI + 1
if strActiveUsersI = 2 then
strActiveUsersI = 0
end if
rs.MoveNext
loop
end if
rs.close
set rs = nothing
'// FIND CURRENT DATE AND TIME
strActiveUsersCurrentDate = Now
'// SET CHECK OUT TIME FOR 11 MINUTES OF INACTIVITY
strActiveUsersCheckOutTime = DATEADD("s", -660, strActiveUsersCurrentDate)
'strSQL = "DELETE FROM Active_Users WHERE LastCheckedIn < '" & strActiveUsersCheckOutTime & "'"
'my_Conn.Execute (strSQL)
my_conn.close
set my_conn = nothing
%>