diff options
author | jim-p <jim@pingle.org> | 2009-06-01 20:54:37 -0400 |
---|---|---|
committer | jim-p <jim@pingle.org> | 2009-06-01 20:54:37 -0400 |
commit | 737ed7d14e997ed9a81aba6a38c6edc4b777dea1 (patch) | |
tree | de8a771ca372d11631ea38aca266a974905d66a5 /usr | |
parent | 145eba307a23bf87c122e16e9f71db23c6a41c22 (diff) | |
download | pfsense-737ed7d14e997ed9a81aba6a38c6edc4b777dea1.zip pfsense-737ed7d14e997ed9a81aba6a38c6edc4b777dea1.tar.gz |
It might help if git was actually tracking the file for this...
Diffstat (limited to 'usr')
-rw-r--r-- | usr/local/www/diag_dns.php | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/usr/local/www/diag_dns.php b/usr/local/www/diag_dns.php new file mode 100644 index 0000000..964763a --- /dev/null +++ b/usr/local/www/diag_dns.php @@ -0,0 +1,95 @@ +<?php +/* + diag_dns.php + + Copyright (C) 2009 Jim Pingle (jpingle@gmail.com) + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ + +$pgtitle = "Diagnostics: DNS"; +require("guiconfig.inc"); + +/* Cheap hack to support both $_GET and $_POST */ +if ($_GET['host']) + $_POST = $_GET; + +if ($_POST) { + unset($input_errors); + + $reqdfields = explode(" ", "host"); + $reqdfieldsn = explode(",", "Host"); + + do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); + $host = trim($_POST['host']); + + if (!(is_hostname($host) || is_ipaddr($host))) { + $input_errors[] = "Host must be a valid hostname or IP address."; + } + + $type = "unknown"; + $resolved = ""; + if (!$input_errors) { + if (is_ipaddr($host)) { + $type = "ip"; + $resolved = gethostbyaddr($host); + } elseif (is_hostname($host)) { + $type = "hostname"; + $resolved = gethostbyname($host); + } + + if ($host == $resolved) { + $resolved = "No record found"; + } + } +} + +include("head.inc"); ?> +<body link="#000000" vlink="#000000" alink="#000000"> +<? include("fbegin.inc"); ?> +<p class="pgtitle"><?=$pgtitle?></p> +<table width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> +<?php if ($input_errors) print_input_errors($input_errors); ?> + <form action="diag_dns.php" method="post" name="iform" id="iform"> + <table width="100%" border="0" cellpadding="6" cellspacing="0"> + <tr> + <td width="22%" valign="top" class="vncellreq">Hostname or IP</td> + <td width="78%" class="vtable"> + <?=$mandfldhtml;?><input name="host" type="text" class="formfld" id="host" size="20" value="<?=htmlspecialchars($host);?>"> + <? if ($resolved && $type) { ?> + = <?php echo $resolved; ?> + <? } ?> + </td> + </tr> + <tr> + <td width="22%" valign="top"> </td> + <td width="78%"> + <input name="Submit" type="submit" class="formbtn" value="DNS Lookup"> + </td> + </tr> + </table> +</form> +</td></tr></table> +<?php include("fend.inc"); ?> |