Привет мужики. За бугром (http://www.hotscripts.com) скачал скрипт который проверяет доменные имена свободен или нет. Подредактировал, добавил доменную зону .ru (whois.ripn.net). Но работает не так как надо, если домена занят то говорит как надо. Если свободен то: --------------------------------------------------------- gfgfhehgtrh.ru занят! % By submitting a query to RIPN's Whois Service % you agree to abide by the following terms of use: % http://www.ripn.net/about/servpol.html#3.2 (in Russian) % http://www.ripn.net/about/en/servpol.html#3.2 (in English). No entries found for the selected source(s). Last updated on 2006.11.30 10:50:45 MSK/MSD --------------------------------------------------------- Сходил по ссылкам, почитал, но нечего не понял... Что скажите?
Три файла: config.inc.php, core.inc.php, queries.inc.php. PHP: //config.inc.php error_reporting(E_ALL); $config['domain']['extensions'] = array ( 'com', 'ru','net','org','biz','info' ); /********************************** The URL to display as a hyperlink. Leave this blank if you do not want to let visitors purchase domains. {DOMAIN} can be used to add in the domain and extension that the visitor entered. ***********************************/ $config['domain']['purchase_url'] = ''; /********************************** Domain purchase text. This doesn't show if you made the variable above blank. ***********************************/ $config['domain']['purchase_text'] = '<a href="'.$config['domain']['purchase_url'].'"> Зарегистрировать {DOMAIN}!</a>'; /********************************** The message to show if the domain is available. {DOMAIN} can be used to add in the domain and extension that the visitor entered. ***********************************/ $config['domain']['available_text'] = '{DOMAIN} свободен!'; /********************************** Do you want to show the whois information if the domain is unavailable? 1 = Yes. 0 = No. ***********************************/ $config['domain']['whois_results'] = 1; /********************************** The message to show if the domain is unavailable. {DOMAIN} can be used to add in the domain and extension that the visitor entered. ***********************************/ $config['domain']['unavailable_text'] = '{DOMAIN} занят!'; /********************************** Do you want vxWhois to log all domain lookups to whois.log? 1 = Yes. 0 = No. ***********************************/ $config['domain']['log_whois'] = 1; /********************************** The location and filename of your whois log file. ***********************************/ $config['domain']['whois_log_location'] = './wcfg/whois.log'; /********************************** Your administrative email address. This is used if an error occurs, and it can be entered in the $message variables below. ***********************************/ $config['user']['admin_email'] = ''; /********************************** This shows if queries.inc.php can not be found in the directory. ***********************************/ $message['error']['no_query_file'] = '<span class="message"><b>Fatal Error:</b> проблема с конфигурационным файлом, свяжитесь с администратором <a href="mailto:'.$config['user']['admin_email'].'">administrator.</a></span>'; /********************************** This shows if the visitor enters three or less characters in the domain name. ***********************************/ $message['error']['lessthan3'] = '<span class="message">Длина доменного имени не менее 3х символов.</span>'; /********************************** This shows if the domain name starts or ends with a hyphen ( - ). ***********************************/ $message['error']['hyphens'] = '<span class="message">Ошибка ввода дефиса.</span>'; /********************************** This shows if the visitor enters special symbols in the domain name. ***********************************/ $message['error']['characters'] = '<span class="message">Ошибка ввода специального символа.</span>'; /********************************** This shows if vxWhois was unable to open whois.log. This may be because you forgot to upload it. ***********************************/ $message['error']['open_log_file'] = '<span class="message">None log.</span>'; /********************************** This shows if whois.log doesn't have the correct permissions. The permissions should be 0666. ***********************************/ $message['error']['perms_log_file'] = '<span class="message">Please CHMOD the file and try again.</span>'; PHP: //core.inc.php error_reporting(E_ALL); function formExtensions (){ global $config; /* Show previous selection */ foreach ($config['domain']['extensions'] as $tld){ echo '<option value="'.$tld.'">'.$tld.'</option>'; } } /* Show Last Domain */ function showPrevious (){ if (isset($_POST['domainForm'])){ echo $_POST['domainForm']; } } /* Write to whois.log file. */ function whoisLog ($domain){ global $message, $config; if (@is_writable($config['domain']['whois_log_location'])){ if (!$fp = @fopen($config['domain']['whois_log_location'], 'a')){ echo $message['error']['open_log_file']; } @fwrite($fp, date('Y-m-d @ H:i:s').' - '.$domain."\r\n"); @fclose($fp); } else { echo $message['error']['perms_log_file']; } } function domainResults (){ /* Declare Global Variables */ global $config, $message; if (isset($_POST['submitForm']) && $_POST['submitForm'] == 'Check'){ /* Check Domain Length, etc. */ if (strlen($_POST['domainForm']) < 3){ echo $message['error']['lessthan3']; } elseif (ereg("^-|-$", $_POST['domainForm'])){ echo $message['error']['hyphens']; } elseif (!ereg("([a-z]|[A-Z]|[0-9]|-){".strlen($_POST['domainForm'])."}", $_POST['domainForm'])){ echo $message['error']['characters']; } else { /* Domain Details for Whois checks */ if (file_exists('./wcfg/queries.inc.php')){ require_once('./wcfg/queries.inc.php'); } else { exit($message['error']['no_query_file']); } /* Do the Whois */ $domain = $_POST['domainForm'].'.'.$_POST['extForm']; $ns = fsockopen($server, 43); fputs($ns, "$domain\r\n"); $result = ''; while(!feof($ns)) $result .= fgets($ns, 128); fclose($ns); if (eregi($avail_msg, $result)){ // Domain is available. if ($config['domain']['purchase_url'] != ''){ $output = str_replace('{DOMAIN}', $domain, $config['domain']['available_text']); $output .= str_replace('{DOMAIN}', $domain, $config['domain']['purchase_text']); } else { $output = str_replace('{DOMAIN}', $domain, $config['domain']['available_text']); } echo $output; } else { // Domain is unavailable. if ($config['domain']['whois_results'] == 1){ $output = str_replace('{DOMAIN}', $domain, $config['domain']['unavailable_text']); echo $output; echo '<pre>'; $fp = fsockopen($server, 43); fputs($fp, "$domain\r\n"); while(!feof($fp)){ echo fgets($fp, 128); } fclose($fp); echo '</pre>'; } else { $output = str_replace('{DOMAIN}', $domain, $config['domain']['unavailable_text']); echo $output; } } /* Write to log file. */ if ($config['domain']['log_whois'] == 1){ whoisLog($domain); } } } } PHP: //queries.inc.php switch ($_POST['extForm']){ // Don't edit this line. case 'com': $server = 'whois.opensrs.net'; $avail_msg = 'Can\'t get information'; break; case 'ru': $server = 'whois.ripn.net'; $avail_msg = 'Can\'t get information'; break; case 'net': $server = 'whois.opensrs.net'; $avail_msg = 'Can\'t get information'; break; case 'org': $server = 'whois.publicinterestregistry.net'; $avail_msg = 'NOT FOUND'; break; case 'biz': $server = 'whois.nic.biz'; $avail_msg = 'Not found'; break; case 'info': $server = 'whois.opensrs.net'; $avail_msg = 'Not found'; break; case 'co.uk': $server = 'whois.nic.uk'; $avail_msg = 'No match for'; break; case 'org.uk': $server = 'whois.nic.uk'; $avail_msg = 'No match for'; break; case 'me.uk': $server = 'whois.nic.uk'; $avail_msg = 'No match for'; break; /* Add more here... */ }