📄 list_logins.cgi
字号:
#!/usr/local/bin/perl# list_logins.cgi# Display the last login locations, tty, login time and durationrequire './user-lib.pl';&ReadParse();$u = $in{'username'};%access = &get_module_acl();if (!$access{'logins'}) { &error("You are not allowed to list logins"); }elsif ($access{'logins'} ne "*") { $u || &error("You are not allowed to list logins"); local @ul = split(/\s+/, $access{'logins'}); &indexof($u,@ul) >= 0 || &error("You are not allowed to list logins for '$u'"); }&header($text{'logins_title'}, "", "list_logins");print "<hr>\n";if ($u) { print "<h3>",&text('logins_head', $u),"</h3>\n"; }print "<table border width=100%> <tr $tb>\n";if (!$u) { print "<td><b>$text{'user'}</b></td>\n"; }print "<td><b>$text{'logins_from'}</b></td>\n";print "<td><b>$text{'logins_tty'}</b></td>\n";print "<td><b>$text{'logins_in'}</b></td>\n";print "<td><b>$text{'logins_out'}</b></td>\n";print "<td><b>$text{'logins_for'}</b></td> </tr>\n";&open_last_command(LAST, $u);while(@last = &read_last_line(LAST)) { print "<tr $cb>", $u ? "" : "<td><tt>$last[0]</tt></td>"; print "<td><tt>", $last[2] ? $last[2] : "Local", "</tt></td> <td><tt>$last[1]</tt></td> ", "<td><tt>$last[3]</tt></td>\n"; if ($last[4]) { print "<td><tt>$last[4]</tt></td> ", "<td><tt>$last[5]</tt></td> </tr>\n"; } else { print "<td colspan=2><tt>$text{'logins_still'}", "</tt></td> </tr>\n"; } $foundany++; if ($max && ++$count >= $max) { # Displayed maximum number last; } }close(LAST);if (!$foundany) { printf "<tr $cb> <td colspan=%d>$text{'logins_none'}</td> </tr>\n", $u ? 5 : 6; }print "</table><p>\n";print "<hr>\n";&footer("", $text{'index_return'});
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -