version 1.2, 2003/02/26 14:10:38
|
version 1.3, 2003/07/29 20:17:52
|
Line 14 use HTTP::Headers;
|
Line 14 use HTTP::Headers;
|
use IO::File; |
use IO::File; |
|
|
|
|
print "Content-type: text/html\n\n". |
print "Content-type: text/html\n\n"; |
"<html><body bgcolor=#FFFFFF>\n"; |
|
# -------------------- Read loncapa.conf (and by default, loncapa_apache.conf). |
# -------------------- Read loncapa.conf (and by default, loncapa_apache.conf). |
my $perlvarref=LONCAPA::Configuration::read_conf('loncapa.conf'); |
my $perlvarref=LONCAPA::Configuration::read_conf('loncapa.conf'); |
my %perlvar=%{$perlvarref}; |
my %perlvar=%{$perlvarref}; |
Line 23 undef $perlvarref; # remove since sensit
|
Line 23 undef $perlvarref; # remove since sensit
|
delete $perlvar{'lonReceipt'}; # remove since sensitive and not needed |
delete $perlvar{'lonReceipt'}; # remove since sensitive and not needed |
delete $perlvar{'lonSqlAccess'}; # remove since sensitive and not needed |
delete $perlvar{'lonSqlAccess'}; # remove since sensitive and not needed |
|
|
print "<h1>User Status ".localtime()."</h1>"; |
my $oneline=($ENV{'QUERY_STRING'} eq 'simple'); |
|
unless ($oneline) { print "<html><body bgcolor=#FFFFFF>\n<h1>User Status ".localtime()."</h1>"; } |
|
|
my $filename; |
my $filename; |
opendir(DIR,$perlvar{'lonIDsDir'}); |
opendir(DIR,$perlvar{'lonIDsDir'}); |
Line 37 while ($filename=readdir(DIR)) {
|
Line 38 while ($filename=readdir(DIR)) {
|
$now=time; |
$now=time; |
$since=$now-$mtime; |
$since=$now-$mtime; |
$sinceacc=$now-$atime; |
$sinceacc=$now-$atime; |
print ("\n\n<hr />"); |
unless ($oneline) { print ("\n\n<hr />"); } |
my %userinfo=(); |
my %userinfo=(); |
undef $userinfo; |
undef $userinfo; |
my $fh=IO::File->new($perlvar{'lonIDsDir'}.'/'.$filename); |
my $fh=IO::File->new($perlvar{'lonIDsDir'}.'/'.$filename); |
Line 56 while ($filename=readdir(DIR)) {
|
Line 57 while ($filename=readdir(DIR)) {
|
if ($since>21600) { $color="#AAAAAA"; $userclass="Inactive"; } |
if ($since>21600) { $color="#AAAAAA"; $userclass="Inactive"; } |
$usercount{$userclass}++; |
$usercount{$userclass}++; |
$usercount{'in Domain '.$userinfo{'user.domain'}}++; |
$usercount{'in Domain '.$userinfo{'user.domain'}}++; |
|
unless ($oneline) { |
print '<font color="'.$color.'">'; |
print '<font color="'.$color.'">'; |
print '<h3>'.$userinfo{'environment.lastname'}.', '. |
print '<h3>'.$userinfo{'environment.lastname'}.', '. |
$userinfo{'environment.firstname'}.' '. |
$userinfo{'environment.firstname'}.' '. |
Line 80 while ($filename=readdir(DIR)) {
|
Line 82 while ($filename=readdir(DIR)) {
|
print "<br /><b>Last Transaction:</b> ".localtime($mtime). |
print "<br /><b>Last Transaction:</b> ".localtime($mtime). |
" (".$since." secs ago) <br /><b>Last Access:</b> ".localtime($atime). |
" (".$since." secs ago) <br /><b>Last Access:</b> ".localtime($atime). |
" (".$sinceacc." secs ago)"; |
" (".$sinceacc." secs ago)"; |
print ("</font>"); |
print ("</font>"); |
|
} |
} |
} |
} |
} |
closedir(DIR); |
closedir(DIR); |
|
unless ($oneline) { |
print "<hr /><h2>User Count</h2>"; |
print "<hr /><h2>User Count</h2>"; |
foreach (sort keys %usercount) { |
foreach (sort keys %usercount) { |
print "<b>".$_.":</b> ".$usercount{$_}."<br />"; |
print "<b>".$_.":</b> ".$usercount{$_}."<br />"; |
} |
} |
|
|
print "</body></html>"; |
print "</body></html>"; |
|
} else { |
|
foreach (sort keys %usercount) { |
|
print $_.'='.$usercount{$_}.'&'; |
|
} |
|
} |