Listing 3
#!/usr/bin/perl -Tw
# /www/html/admin/cgi-bin2/gethost.cgi
# CGI script front-end to the 'gethost' prgram
#
# by John D. Shearer
# Version 1.0a
use CGI;
$page = CGI::new();
print $page->header();
print $page->start_html(-title=>'GetHost Web Front-End');
print "<center><h2>Front-End to the GetHost Program</h2>\n";
print "Use a . (dot) for a full list</center>\n";
print $page->startform(-method=>POST,
-action=>'gethost.cgi');
print $page->textfield(-name=>"string",
-size=>60,
-maxlength=>40);
print $page->submit('Search');
print "\n";
print $page->end_form();
$search = $page->param('string');
print <<EOD;
e-mail Logons will appear between curly braces: { }<BR>
(e-mail logons are from the past 3 calendar days.)<br>
WINS information will appear between square brackets: [ ]
EOD
if ($search) {
print "<PRE>\n";
print "IP Address Most Recent Lease MAC Address Computer Name Inventory Assignment { e-mail } and [ WINS ] ->\n";
print "--------------- ------------------- ------------ --------------- ------------------------ --------------------------\n";
open FILE, "/home/jsmith/gethost.list";
while (<FILE>) {
next unless /\Q$search/i;
printf "$_";
}
close FILE;
print "\n</PRE>";
print "<b>END</b>\n";
}
print $page->end_html;
|