function get_whois($ip) { require_once JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_bfstop' . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'phpwhois' . DIRECTORY_SEPARATOR . 'whois.main.php'; require_once JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_bfstop' . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'phpwhois' . DIRECTORY_SEPARATOR . 'whois.utils.php'; $whois = new Whois(); $whois->non_icann = true; $result = $whois->Lookup($ip); $winfo = ''; if (!empty($result['rawdata'])) { $utils = new utils(); return $utils->showHTML($result); } else { if (isset($whois->Query['errstr'])) { $winfo = implode("\n<br></br>", $whois->Query['errstr']); } else { $winfo = 'Unexpected error'; } } return $winfo; }
function render_tab1() { global $aio_wp_security; ?> <h2><?php _e('WHOIS Lookup Information', 'aiowpsecurity'); ?> </h2> <div class="aio_blue_box"> <?php echo '<p>' . __('This feature allows you to look up more detailed information about an IP address or domain name by querying the WHOIS API.', 'aiowpsecurity') . ' </p>'; ?> </div> <div class="postbox"> <h3><label for="title"><?php _e('Perform a WHOIS Lookup for an IP or Domain Name', 'aiowpsecurity'); ?> </label></h3> <div class="inside"> <form action="" method="POST"> <?php wp_nonce_field('aiowpsec-whois-lookup-nonce'); ?> <table class="form-table"> <tr valign="top"> <th scope="row"><?php _e('Enter IP Address or Domain Name', 'aiowpsecurity'); ?> :</th> <td><input type="text" size="20" name="aiowps_whois_lookup_field" value="<?php //echo $aio_wp_security->configs->get_value('aiowps_whois_lookup_field'); ?> " /> <span class="description"><?php _e('Enter an IP address or domain name. Example: 111.11.12.13 OR some-domain-name.com', 'aiowpsecurity'); ?> </span> </td> </tr> </table> <input type="submit" name="aiowps_whois_lookup" value="<?php _e('Perform IP or Domain Lookup', 'aiowpsecurity'); ?> " class="button-primary ip-domain-lookup" /> </form> </div></div> <?php if (isset($_POST['aiowps_whois_lookup'])) { $nonce = $_REQUEST['_wpnonce']; if (!wp_verify_nonce($nonce, 'aiowpsec-whois-lookup-nonce')) { $aio_wp_security->debug_logger->log_debug("Nonce check failed on WHOIS lookup!", 4); die("Nonce check failed on WHOIS lookup!"); } require_once AIO_WP_SECURITY_LIB_PATH . '/whois/whois.main.php'; require_once AIO_WP_SECURITY_LIB_PATH . '/whois/whois.utils.php'; $input_val = trim($_POST['aiowps_whois_lookup_field']); if (filter_var($input_val, FILTER_VALIDATE_IP) || filter_var(gethostbyname($input_val), FILTER_VALIDATE_IP)) { //$info_msg_string = '<p class="aio_info_with_icon">'.sprintf( __('WHOIS lookup successfully completed. Please see the results below:', 'aiowpsecurity')).'</p>'; //echo ($info_msg_string); $this->show_msg_updated(__('WHOIS lookup successfully completed. Please see the results below:', 'aiowpsecurity')); $whois = new Whois(); $result = $whois->Lookup($input_val); if (!empty($result['rawdata'])) { $utils = new utils(); $winfo = $utils->showHTML($result); echo $winfo; } } else { $this->show_msg_error(__('You have entered an incorrectly formatted IP address or domain name. Please try again.', 'aiowpsecurity')); } } }
$result = $whois->Lookup($query); $resout = str_replace('{query}', $query, $resout); $winfo = ''; switch ($output) { case 'object': if ($whois->Query['status'] < 0) { $winfo = implode($whois->Query['errstr'], "\n<br></br>"); } else { $utils = new utils(); $winfo = $utils->showObject($result); } break; case 'nice': if (!empty($result['rawdata'])) { $utils = new utils(); $winfo = $utils->showHTML($result); } else { if (isset($whois->Query['errstr'])) { $winfo = implode($whois->Query['errstr'], "\n<br></br>"); } else { $winfo = 'Unexpected error'; } } break; case 'proxy': if ($allowproxy) { exit(serialize($result)); } default: if (!empty($result['rawdata'])) { $winfo .= '<pre>' . implode($result['rawdata'], "\n") . '</pre>';