Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <title>DNS Record Lookup by Yunus Incredibl</title>
- <form method="POST">
- Hostname : <input type="text" name="hostname" size="50" placeholder="www.site.com" style='border: solid 1px red'>
- <br><br>Record : <select style='border: solid 1px red' name='record'>
- <?php
- /*
- DNS Record Lookup
- by YunusIncredibl
- 2014
- */
- set_time_limit (0);
- $records = array ("A", "CNAME", "MX", "NS", "PTR", "SOA", "TXT", "AAAA", "ALL");
- foreach ($records as $record)
- echo "<option>".$record."</option>";
- echo '</select><br><br><input type="submit" value="Lookup" name="go"><br></form>';
- if (@$_POST['go'])
- {
- $host = $_POST['hostname'];
- if (@preg_match ("/:\/\//", $host))
- $host = parse_url ($host, PHP_URL_HOST);
- $rec = $_POST['record'];
- switch ($rec)
- {
- case "A":
- fetch_dns_record ($host, DNS_A);
- break;
- case "CNAME":
- fetch_dns_record ($host, DNS_CNAME);
- break;
- case "MX":
- fetch_dns_record ($host, DNS_MX);
- break;
- case "NS":
- fetch_dns_record ($host, DNS_NS);
- break;
- case "PTR":
- fetch_dns_record ($host, DNS_PTR);
- break;
- case "SOA":
- fetch_dns_record ($host, DNS_SOA);
- break;
- case "TXT":
- fetch_dns_record ($host, DNS_TXT);
- break;
- case "AAAA":
- fetch_dns_record ($host, DNS_AAAA);
- break;
- case "ALL":
- fetch_dns_record ($host, DNS_ALL);
- break;
- default:
- break;
- }
- }
- function fetch_dns_record ($host, $type)
- {
- if (!$record = @dns_get_record ($host, $type))
- die ("DNS Query failed !");
- foreach ($record as $y)
- {
- echo "<br><br>";
- foreach ($y as $x => $k)
- echo $x." : "."$k<br>";
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement