<?php
/* как сделать, чтобы дохуя доменов проверяло? */
$domain_name = "yoba"; //POST-значение текстового поля для домена
$zone = "com"; //POST селекта с зоной
$domain=$domain_name.'.'.$zone;
 
$resp = get_whois($domain); # получаем whois-запись
 
preg_match("!^\s*Whois Server:\s+([\w\.]+)\b!im", $resp, $matches); # извлекаем адрес whois-сервера
$server = $matches[1];
 
preg_match("!^\s*Expiration Date:\s+([\w\-]+)\b!im", $resp, $matches); # извлекаем дату истечения срока домена
$expiry = $matches[1];
 
$exptime = strtotime($expiry); # вычисляем количество дней до окончания срока
$expdays = round(($exptime - time()) / 84600);
$expiry = date("d/m/Y", $exptime);
 
print $whois_doman = "$domain &#160; ";
print $whois_server = "$server &#160; ";
print $whois_expires = "$expiry &#160; ";
print $whois_days ="days: $expdays";
 
$array = array (
        "biz" => "whois.neulevel.biz",
        "com" => "whois.internic.net",
        "us" => "whois.nic.us",
        "coop" => "whois.nic.coop",
        "info" => "whois.nic.info",
        "name" => "whois.nic.name",
        "net" => "whois.internic.net",
        "gov" => "whois.nic.gov",
        "edu" => "whois.internic.net",
        "mil" => "rs.internic.net",
        "int" => "whois.iana.org",
        "ac" => "whois.nic.ac",
        "ae" => "whois.uaenic.ae",
        "at" => "whois.ripe.net",
        "au" => "whois.aunic.net",
        "be" => "whois.dns.be",
        "bg" => "whois.ripe.net",
        "br" => "whois.registro.br",
        "bz" => "whois.belizenic.bz",
        "ca" => "whois.cira.ca",
        "cc" => "whois.nic.cc",
        "ch" => "whois.nic.ch",
        "cl" => "whois.nic.cl",
        "cn" => "whois.cnnic.net.cn",
        "cz" => "whois.nic.cz",
        "de" => "whois.nic.de",
        "fr" => "whois.nic.fr",
        "hu" => "whois.nic.hu",
        "ie" => "whois.domainregistry.ie",
        "il" => "whois.isoc.org.il",
        "in" => "whois.ncst.ernet.in",
        "ir" => "whois.nic.ir",
        "mc" => "whois.ripe.net",
        "to" => "whois.tonic.to",
        "tv" => "whois.tv",
        "ru" => "whois.ripn.net",
        "org" => "whois.pir.org",
        "aero" => "whois.information.aero",
        "nl" => "whois.domain-registry.nl"
    );

 
/* тута шота сломалось */
foreach ($array as $key=>$value) {
if ($key==$zone) $server=$value;
}
 
function get_whois ($domain, $server) {
if (trim($domain) <> "");
}
/* тута шота сломалось */
 
$domain = trim($domain);
$fp = fsockopen($server, 43, $errno, $errstr, 30); 
if (!$fp) {
$response = "$errstr ($errno)"
} else {
$response = "";
fputs($fp, "$domain\r\n");
while (!feof($fp))
$response .= fread($fp,128);
fclose ($fp);
}
} //код ужасен, я бы тебе за него руки оторвал, мудило
 
/* как захуячить if else "домен свободен" */
//примерно так
if (@$sock = fsockopen ($server, 80, $errno, $errstr, 0.2)) {
echo "Сосни хуйца";
fclose ($sock);
} else {
echo "Всё круто";
}
 
return $response; //как ты уже понял, нахуй не надо это говно
}
?>