--- php/hawk.php.orig 2001-11-08 21:58:52.000000000 +0000 +++ php/hawk.php 2012-02-05 12:09:21.000000000 +0000 @@ -10,6 +10,7 @@ # map these variables $sortby=$HTTP_POST_VARS["sortby"]; $network=$HTTP_POST_VARS["network"]; + $for_rev_check=$HTTP_POST_VARS["for_rev_check"]; $showeverydamnthing=$HTTP_POST_VARS["showeverydamnthing"]; $sortoptions = array ( @@ -38,6 +39,18 @@ print "\n"; + print "
"; + + if ($for_rev_check || ($for_rev_check_default && !$network)) { + $checked = "checked"; + } + else { + $checked = ""; + } + checkbox("for_rev_check", $checked); + print "  Indicate if the forward and reverse hostnames match."; + print "
"; + if ($showeverydamnthing) { $checked = "checked"; } @@ -51,7 +64,6 @@ print ""; # href("#key", "Key"); - print "
"; # show everything until network selection is implemented if ($network) { @@ -70,7 +82,7 @@ ##################################################### function shownet ($network) { - global $dbuser, $dbpass, $dbhost, $dbname, $redzone, $yellowzone, $sortby, $showeverydamnthing; + global $dbuser, $dbpass, $dbhost, $dbname, $redzone, $yellowzone, $sortby, $for_rev_check, $showeverydamnthing, $purple_string; if (!$link=@mysql_connect($dbhost, $dbuser, $dbpass)) { $errormsg = mysql_error(); print urlencode($errormsg); @@ -87,10 +99,10 @@ # select them all for now if ($sortby == ip) { - $query = "select ip, hostname, lastping from hawk.ip order by inet_aton(ip)"; + $query = "select ip, hostname, lastping, for_rev_match from hawk.ip order by inet_aton(ip)"; } else { - $query = "select ip, hostname, lastping from hawk.ip order by '$sortby'"; + $query = "select ip, hostname, lastping, for_rev_match from hawk.ip order by '$sortby'"; } if (!$result = @mysql_query($query)) { @@ -110,7 +122,7 @@ extract ($record); # only show blank ping/hostname records if $showeverydamnthing is set - if ($hostname == "" && $lastping == 0 && !$showeverydamnthing) continue 1; + if ((!$hostname || strstr($hostname, $purple_string)) && !$lastping && !$showeverydamnthing) continue 1; if (!testip($network, $ip)) continue 1; @@ -126,24 +138,28 @@ print ""; # no hostname, no ping response - if (!$hostname && !$lastping) { - print "";img("images/purplesphere.png");print ""; + if ((!$hostname || strstr($hostname, $purple_string)) && !$lastping) { + print "";img("images/purplesphere.png", 20, 20, "purple");print ""; } # ping response, but no hostname elseif ($lastping > (time() - $redzone) && !$hostname) { - print "";img("images/bluesphere.png");print ""; + print "";img("images/bluesphere.png", 20, 20, "blue");print ""; + } + # forward and reverse hostnames do not match + elseif ($for_rev_check && !$for_rev_match) { + print "";img("images/questionsphere.png", 20, 20, "question");print ""; } # ping response in "red zone" elseif ((time() - $redzone) > $lastping) { - print "";img("images/redsphere.png");print ""; + print "";img("images/redsphere.png", 20, 20, "red");print ""; } # ping response in "yellow zone" elseif ((time() - $yellowzone) > $lastping) { - print "";img("images/yellowsphere.png");print ""; + print "";img("images/yellowsphere.png", 20, 20, "yellow");print ""; } # recent ping response, hostname ok else { - print "";img("images/greensphere.png");print ""; + print "";img("images/greensphere.png", 20, 20, "green");print ""; } print "$ip"; print "$hostname "; @@ -160,28 +176,34 @@ ##################################################### function showkey () { - global $yellowzone, $redzone; + global $for_rev_check, $yellowzone, $redzone; print "\n"; print ""; + if ($for_rev_check) { + print "\n"; + } + print "\n"; print "\n"; print "\n"; print "\n"; print "
Key:  "; - img("images/greensphere.png", 10, 10); + img("images/greensphere.png", 10, 10, "green"); print " Host in DNS. Recent ping response.
"; + img("images/questionsphere.png", 10, 10, "question"); + print " Host in DNS. Forward and reverse hostnames do not match.
"; - img("images/yellowsphere.png", 10, 10); + img("images/yellowsphere.png", 10, 10, "yellow"); print " Host in DNS. No ping response for over $yellowzone seconds.
"; - img("images/redsphere.png", 10, 10); + img("images/redsphere.png", 10, 10, "red"); print " Host in DNS. No ping response for over $redzone seconds.
"; - img("images/purplesphere.png", 10, 10); + img("images/purplesphere.png", 10, 10, "purple"); print " Host not in DNS. No ping response.
"; - img("images/bluesphere.png", 10, 10); + img("images/bluesphere.png", 10, 10, "blue"); print " Host not in DNS. Recent ping response.
"; @@ -196,6 +218,8 @@ + + @@ -244,9 +268,9 @@ } - function img ($image, $height="", $width="") { + function img ($image, $height="", $width="", $text="") { - print ""; + print "$text"; }