From b90f8cdac9371c219a72dda16f8deecc7c44fc28 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 3 Dec 2000 20:25:20 +0000 Subject: session monitor updates --- htdocs/browse/nas.cgi | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 'htdocs/browse/nas.cgi') diff --git a/htdocs/browse/nas.cgi b/htdocs/browse/nas.cgi index 2aafbc1fd..a65235b1e 100755 --- a/htdocs/browse/nas.cgi +++ b/htdocs/browse/nas.cgi @@ -33,10 +33,29 @@ foreach my $nas ( sort { $a->nasnum <=> $b->nasnum } qsearch( 'nas', {} ) ) { ; foreach my $port ( sort { $a->nasport <=> $b->nasport || $a->portnum <=> $b->portnum - } qsearch( 'port' ) ) { + } qsearch( 'port', { 'nasnum' => $nas->nasnum } ) ) { + my $session = $port->session; + my($user, $since, $pretty_since, $duration); + if ( ! $session ) { + $user = "(empty)"; + $since = 0; + $pretty_since = "(never)"; + $duration = ''; + } elsif ( $session->logout ) { + $user = "(empty)"; + $since = $session->logout; + } else { + my $svc_acct = $session->svc_acct; + $user = "svcnum. "\">". + $svc_acct->username. ""; + $since = $session->login; + } + $pretty_since = time2str("%c", $since) if $since; + $duration = pretty_interval( $now - $since ). " ago" + unless defined($duration); print "". $port->nasport. "". $port->portnum. "". - $port->ip. "". 'user'. "". 'since'. "". - 'duration'. "" + $port->ip. "$user$pretty_since". + "$duration" ; } print "
"; -- cgit v1.2.1