#!/usr/local/bin/perl # # Who's on the machine at this time ? # # $version="1.00b"; # (c) 1998 Emmanuel PIERRE # epierre@e-nef.com # http://www.e-nef.com/users/Emmanuel.PIERRE # # Some default variables: local ($tab); print "Content-type: text/html\n\n"; $txt .= "\n"; $txt .= "\n\t\n\t\n\t\n\t\n\t\n\n"; ($fic = open(RWHOD,"/usr/bin/rwho |")) or die "ERR: $!"; (kill 0,$fic) or die "rwho invocation failed"; while ($lec=) { #print "-->$lec"; chomp($lec); ($nom, $hote, $tty, $month, $day, $hour, $idletime) = ($lec =~ m/(\S+)\s+(\S+)\:(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s*(.*)/s); #print "->$nom
\n"; if ($nom ne "") { if (! grep(/$nom/,@tab)) { push(@tab, "$nom $hote $tty $month $day $hour $idletime"); # print "$_
\n"; } } } close(FICHIER); $txt .= "\t
\n"; foreach $rec (@tab) { $_ = $rec; #print "->$_
\n"; ($nom, $hote, $tty, $month, $day, $hour, $idletime) = split(/ /, $rec); if ($nom ne "") { $txt .= "\t
"; $txt .= "\n"; } } #$txt .= "\t\n"; $txt .= "
NameDateHeureIdleAction
$nom\@$hote$day $month 97$hour$idletime"; $txt .= ""; $txt .= "
\n"; $table .="
\n"; $table .="\t\n\t\n"; $table .= "
adresse E-mail:
votre vrai nom:
\n"; $table .= "

Message:
\n\t

\n votre message ou \n"; $table .= "\n\n"; if (($#tab)>-1) { print $txt; print $table; } else { print " Il n'y a personne en ce moment ...

"; print " Mais vous pouvez nous laisser un message !

"; print "\t

\n"; print $table; } exit;