summaryrefslogtreecommitdiff
path: root/cgi-bin/hosts.plx
blob: a37cc4166b641a658422d63ba8ea57330dd8dcd2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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;