Message-ID: <002001c10633$ad8c0ce0$1964a8c0@craig> From: "Craig Hulbert" <craig@daytondigital.net> Subject: Re: [Emerald] query for showing user online time? Date: Fri, 6 Jul 2001 11:52:36 -0400
Monica,
I hope this helps.... this is what we built... works great for us.
Oh, and we use ICverify.. works ok.. not as automated as I would like
it...but
it works..
Craig Hulbert
Dayton Digital Networks
www.daytondigital.net
Requires emerarld.udl to be setup to connect to your sql server...
The display aspcode...
<%@ LANGUAGE="VBSCRIPT"%>
<%Option Explicit%>
<!--#include virtual = "admin_toolkit.asp"-->
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="center" colspan="2">
<%=DoDialog_Show("Find", DoFind_Form)%>
</td>
</tr>
<tr>
<td class="center">
<%=DoDialog_Show("Dial Up", DoWhoIsOn_Show)%>
</td>
<td class="center">
<%'=DoDialog_Show("Clients", DoClient_Stats_Show)%>
</td>
<td class="center">
<%If DoRep_Right_Check(DoLogon_User_Get, DoObject_Name_Get, ptFull_Control)
Then
'Response.Write(DoDialog_Show("Domains", DoDomain_Stats_Show("")))
End If%>
</td>
</tr>
</table>
Place below in admin_toolkit.asp
Function DoWhoIsOn_Show
Dim strSQL
Dim objRst
Dim objConn_Emerald
Dim lngRecord_Count
Dim strOutput
strSQL = "SELECT NASPort, Username, CallDate, FramedAddress "
strSQL = strSQL & "FROM CallsOnline "
strSQL = strSQL & "WHERE AcctStatusType = 1 "
strSQL = strSQL & "ORDER BY Username "
Set objConn_Emerald = Server.CreateObject("ADODB.Connection")
objConn_Emerald.Open Application("Connection_Emerald")
Set objRst = Server.CreateObject("ADODB.RecordSet")
objRst.Open strSQL, objConn_Emerald
If objRst.EOF Then
strOutput = "<p>There are no active calls</p>" & vbCRLF
Else
strOutput = "<table border=""0"" cellspacing=""0"" cellpadding=""4"">"
& vbCRLF
strOutput = strOutput & " <tr>" & vbCRLF
strOutput = strOutput & " <td><b>Port</b></td>" & vbCRLF
strOutput = strOutput & " <td><b>Username</b></td>" & vbCRLF
strOutput = strOutput & " <td><b>Date</b></td>" & vbCRLF
strOutput = strOutput & " <td><b>Framed Address</b></td>" & vbCRLF
strOutput = strOutput & " </tr>" & vbCRLF
lngRecord_Count = 0
While Not objRst.EOF
strOutput = strOutput & " <tr>" & vbCRLF
' strOutput = strOutput & " <td><a href=""/user.asp?" &
Request.QueryString & "&user_id=" & objRst("User_ID") & """>" &
objRst("User_Name") & " (" & objRst("Full_Name") & ")</a></td>" & vbCRLF
strOutput = strOutput & " <td align=""right"">" &
objRst("NASPort") & "</td>" & vbCRLF
strOutput = strOutput & " <td>" & objRst("Username") & "</td>" &
vbCRLF
strOutput = strOutput & " <td>" & objRst("CallDate") & " (" &
DateDiff("n", objRst("CallDate"), Now()) & " min)</td>" & vbCRLF
strOutput = strOutput & " <td>" & objRst("FramedAddress") &
"</td>" & vbCRLF
strOutput = strOutput & " <td> </td>" & vbCRLF
strOutput = strOutput & " </tr>" & vbCRLF
objRst.MoveNext
lngRecord_Count = lngRecord_Count + 1
Wend
strOutput = strOutput & "</table>" & vbCRLF
If lngRecord_Count > 1 Then
strOutput = strOutput & "<hr/>" & vbCRLF
strOutput = strOutput & "There are <b>" & lngRecord_Count & "</b>
users currently online" & vbCRLF
End If
End If
objRst.Close
objConn_Emerald.Close
Set objRst = Nothing
Set objConn_Emerald = Nothing
DoWhoIsOn_Show = strOutput
End Function ' DoWhoIsOn_Show%>