diff options
Diffstat (limited to 'cgi-bin/hosts.plx')
| -rw-r--r-- | cgi-bin/hosts.plx | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/cgi-bin/hosts.plx b/cgi-bin/hosts.plx new file mode 100644 index 0000000..a37cc41 --- /dev/null +++ b/cgi-bin/hosts.plx @@ -0,0 +1,45 @@ +#!c:/perl/bin/perl + +# UNIX shebang line +# +#!/usr/local/bin/perl -w + +# Use me +# +use CGI; +use strict; +use Globals; +use Globals qw($bgcolour); +my $counter = 0; + +my $WEBPAGE; +my $SERVERS; +my $USERS; + +# Start the page. +# +open TEMPLATE, "../templates/hosts.template" or die; + +while ( <TEMPLATE> ) +{ + $WEBPAGE .= $_; +} + +# Build a list of hosts and IPs +# +open (USERFILE, "../data/users.txt"); + +while (<USERFILE>) +{ + chomp; + my @thisuser = split(';'); + + $USERS .= "<tr><td><span style=\"color:white;font-weight:bold;\">$thisuser[1]</span></td><td>$thisuser[0]</td><td>$thisuser[2]</td></tr>"; +} +close( HOSTFILE ); + +$WEBPAGE =~ s/%USERLIST%/$USERS/g; +$WEBPAGE =~ s/%BGCOLOUR%/$bgcolour/g; + +print $WEBPAGE; +exit; |
