rendered paste body#!/usr/bin/perl
use strict;
use warnings;
use HTTP::Daemon;
use HTTP::Status;
my $httpd = new HTTP::Daemon( LocalAddr => '172.16.48.48',
# LocalPort => 8080
) or die();
print "DHCPd WebAdmin started on ". $httpd->url() . "\n";
while (my $connection = $httpd->accept)
{
while (my $request = $connection->get_request())
{
&clear_expired_sessions();
if ($request->method() eq 'GET')
{
if ($request->url()->path() eq "/") {
$connection->send_file('template/header.html');
$connection->send_file('template/index.html');
$connection->send_file('template/footer.html');
$connection->force_last_request();
} else {
$connection->send_error(RC_FORBIDDEN);
}
} else {
$connection->send_error(RC_FORBIDDEN);
}
}
$connection->close();
undef($connection);
}