<form action="<?php echo $_SERVER['PHP_SELF']; ?> "> <p><b><label for="domain">Domain/IP Address:</label></b> <input type="text" name="domain" id="domain" value="<?php echo $domain; ?> "> <input type="submit" value="Lookup"></p> </form> <?php if ($domain) { $domain = trim($domain); if (substr(strtolower($domain), 0, 7) == "http://") { $domain = substr($domain, 7); } if (substr(strtolower($domain), 0, 4) == "www.") { $domain = substr($domain, 4); } if (ValidateIP($domain)) { $result = LookupIP($domain); } elseif (ValidateDomain($domain)) { $result = LookupDomain($domain); } else { die("Invalid Input!"); } echo "<pre>\n" . $result . "\n</pre>\n"; } ?> </body> </html>
<button type="submit" class="<?php echo get_btn(); ?> ">查詢</button> </div> </div> </form> <?php if (!empty($domain)) { $domain = trim($domain); if (substr(strtolower($domain), 0, 7) == "http://") { $domain = substr($domain, 7); } if (substr(strtolower($domain), 0, 4) == "www.") { $domain = substr($domain, 4); } if (ValidateIP($domain)) { $result = '<pre class="<?php echo get_alert_class("info"); ?>">' . LookupIP($domain) . '</pre>'; } else { if (ValidateDomain($domain)) { $result = '<pre class="<?php echo get_alert_class("info"); ?>">' . LookupDomain($domain) . '</pre>'; } else { $result = '<div class="<?php echo get_alert_class("danger"); ?>">輸入格式錯誤!</div>'; } } } echo $result; ?> <?php get_footer();