Re: Users Online Inaccurate?

Dale E. Reed Jr. ( (no email) )
Thu, 28 May 1998 01:49:23 -0700

Lawrence Watkins Work wrote:
>
> I looked for the trigger and was not able to find it.
> Perhaps you could post the location to d/l it at.

See Below:

if exists (select * from sysobjects where id = object_id('dbo.calls_insert') and
sysstat & 0xf = 8)
drop trigger dbo.calls_insert
GO

CREATE TRIGGER calls_insert ON dbo.Calls
FOR INSERT
AS
UPDATE ServerPorts
Set sp.UserName = i.UserName,
sp.AcctStatusType = i.AcctStatusType,
sp.CallDate = DateAdd(Second, 0-i.AcctDelayTime, i.CallDate),
sp.FramedAddress = i.FramedAddress
FROM Servers s, ServerPorts sp, inserted i
WHERE s.IPAddress = i.NASIdentifier AND
s.ServerID = sp.ServerID AND
sp.Port = i.NASPort AND
(DateAdd(Second, 0-i.AcctDelayTime, i.CallDate) >= sp.CallDate OR
sp.CallDate IS NULL)

UPDATE SubAccounts
Set sa.TimeLeft = sa.TimeLeft - (i.AcctSessionTime/60 + 1)
FROM SubAccounts sa, inserted i
WHERE sa.login = i.UserName
and sa.TimeLeft <> NULL
and i.AcctStatusType = 2

GO

-- Dale E. Reed Jr.  (daler@iea-software.com)_________________________________________________________________       IEA Software, Inc.      |  RadiusNT, Emerald, and NT FAQs Internet Solutions for Today  |   http://www.iea-software.com