(.+)<\/title>/is) {$title = $1}; # Re-Extract title
} # End - If we get the 401 Unauthorized response
if ($title ne 'Untitled Document') { # If we did not get the expected page
LAM::displayPage('-e', 'Unexpected Response',
"\nExpected 'Untitled Document' page.\n",
"Router Status URI: $cF{'Router Status URI'}
Request Response:
\n".
textarea({-name=>'Request Response', -wrap=>'soft', -rows=>18, -columns=>85,
-value=>$response, -READONLY=>1}) . $ProgramHead1) # display response
} else { # Extract the rest of the parameters and display in a web page
if ($response =~ /IP Address<\/B><\/td>\s*(.+?)<\/td>/s)
{$ipAddress = $1};
if ($response =~ /Subnet Mask<\/B><\/td>\s* | (.+?)<\/td>/s)
{$subnetMask = $1};
if ($response =~ /Default Gateway<\/B><\/td>\s* | (.+?)<\/td>/s)
{$defaultGateway = $1};
if ($response =~ /DHCP Server<\/B><\/td>\s* | (.+?)<\/td>/s)
{$dhcpServer = $1};
if ($response =~ /DNS Server<\/B><\/td>\s* | (.+?)<\/td>/s)
{$dnsServer = $1};
if ($response =~ /Lease Obtained<\/B><\/td>\s* | (.+?)<\/td>/s)
{$leaseObtained = $1};
if ($response =~ /Lease Expires<\/B><\/td>\s* | (.+?)<\/td>/s)
{$leaseExpires = $1};
my $oldIPcolor = $cF{'No Change color'}; # Set background for Old IP
if ($ipAddress ne $oldIP) {$oldIPcolor = $cF{'Change Detected color'}};
my $timeMark = LAM::timemark(time, '1');
my $timeMarkColor = $cF{'Change Detected color'}; # Highlight timemark
if (($leaseObtained le $timeMark) and ($timeMark le $leaseExpires))
{$timeMarkColor = $cF{'No Change color'}}; # If within lease time range
my $tr = ' | ';
my $table = "\n\n"
. " IP Address:\t | '
. "\n\n\t\t$ipAddress\t$tr\n\n"
. " Cable Modem MAC Address: | $cF{'Cable Modem MAC Address'}$tr\n"
. "Internet Port MAC Address: | $cF{'Internet Port MAC Address'}$tr\n\n"
. " Subnet Mask: | $subnetMask$tr\n"
. "Default Gateway: | $defaultGateway$tr\n"
. " DHCP Server: | $dhcpServer$tr\n"
. " DNS Server: | $dnsServer$tr\n"
. " Lease Obtained: | $leaseObtained$tr\n"
. "Current Date Time: | $timeMark$tr\n"
. " Lease Expires: | $leaseExpires$tr\n"
. " Old IP Address: | $oldIP\n"
. " | \n\n\n";
LAM::displayPage('-c', '-t', " LAM Alaska $title", '', $ProgramHead1 . $table
. $eV); } # End - If we did not get the expected page / Extract the rest ...
# ..:....|....:....|....:....|....:....|....:....|....:....|....:....|....:....|
sub loadConfigHash { my %configParameter = (); # Define a hash!
# modified from Perl Cookbook 8.16 Reading Configuration files
while() { # Load parameters from configuration file into a hash
chomp; # strip newline
s/#.*//; # strip comments
s/^\s+//; # strip leading white space
s/\s+$//; # strip trailing white space
next unless length; # skip empty lines
last unless not m/z End of Basic Better Configuration paramters/;
my ($var, $value) = split(/\s*=\s/, $_, 2);
$configParameter{$var} = $value;
} # End - Load parameters from configuration file into a hash
return %configParameter
}
|