diff options
Diffstat (limited to 'htdocs/browse/nas.cgi')
-rwxr-xr-x | htdocs/browse/nas.cgi | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/htdocs/browse/nas.cgi b/htdocs/browse/nas.cgi index 2aafbc1..a65235b 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 = "<A HREF=\"$p/view/svc_acct.cgi?". $svc_acct->svcnum. "\">". + $svc_acct->username. "</A>"; + $since = $session->login; + } + $pretty_since = time2str("%c", $since) if $since; + $duration = pretty_interval( $now - $since ). " ago" + unless defined($duration); print "<TR><TD>". $port->nasport. "</TD><TD>". $port->portnum. "</TD><TD>". - $port->ip. "</TD><TD>". 'user'. "</TD><TD>". 'since'. "</TD><TD>". - 'duration'. "</TD></TR>" + $port->ip. "</TD><TD>$user</TD><TD>$pretty_since". + "</TD><TD>$duration</TD></TR>" ; } print "</TABLE><BR>"; |