Показать сообщение отдельно

  #23  
Старый 12.01.2008, 10:11
NNNS
Познающий
Регистрация: 26.05.2007
Сообщений: 63
С нами: 9979529

Репутация: 86
По умолчанию

Скрипт чекает короткие домены в зонах .ru, .su



PHP код:
<?
error_reporting  
(0);
set_time_limit   (0);
#-------------------------------------*
#        short domain checker
#        by NNNS {icq: 474374}
#-------------------------------------*
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>short domain checker by NNNS</title>
<style type="text/css">
<!--
body,td,th {
}
.titler {
    font-family: Georgia, "Times New Roman", Times, serif;
    font-size: 24px;
    color: #666666;
    border-bottom-width: 1px;
    border-bottom-style: dashed;
    border-bottom-color: #3399FF;
}
.error {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
    color: #B0B0B0;
    border-bottom-width: 1px;
    border-bottom-style: dashed;
    border-bottom-color: #E25053;
    text-align: center;
}
.titler:hover {
    color: #3399FF;
    border-bottom-color: #666666;
}
.edit {
    font-family: Georgia, "Times New Roman", Times, serif;
    font-size: 12px;
    color: #3399FF;
    border: 1px solid #E8E8E8;
    height: 16px;
    width: 50px;
    text-align: center;
    margin-right: 2px;
}
.true {
    font-size: 12px;
    color: #9ABB26;
    font-family: Arial, Helvetica, sans-serif;
}
.text {
    font-family: Georgia, "Times New Roman", Times, serif;
    color: #B0B0B0;
    font-size: 12px;
}
.buttoncheg {
    font-family: Georgia, "Times New Roman", Times, serif;
    font-size: 12px;
    color: #B0B0B0;
    border: 1px solid #E8E8E8;
    background-color: #FFFFFF;
    height: 20px;
    width: 50px;
}
.false {
    font-size: 12px;
    color: #CC090E;
    font-family: Arial, Helvetica, sans-serif;
}
.tables {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
    border-bottom-width: 1px;
    border-bottom-style: solid;
    border-bottom-color: #ECF5FF;
}
.text2 {
    font-family: Arial, Helvetica, sans-serif;
    color: #B0B0B0;
    font-size: 12px;
}
.text3 {
    font-family: Arial, Helvetica, sans-serif;
    color: #3399FF;
    font-size: 12px;
}
.selecte {
    font-family: Georgia, "Times New Roman", Times, serif;
    font-size: 10px;
    color: #3399FF;
    border: 1px solid #E8E8E8;
    height: 18px;
    width: 100px;
    text-align: center;
    margin-right: 2px;
}
.edit2 {
    font-family: Georgia, "Times New Roman", Times, serif;
    font-size: 12px;
    color: #3399FF;
    border: 1px solid #E8E8E8;
    height: 16px;
    width: 75px;
    text-align: center;
    margin-right: 2px;
}
.selecte2 {
    font-family: Georgia, "Times New Roman", Times, serif;
    font-size: 10px;
    color: #3399FF;
    border: 1px solid #E8E8E8;
    height: 18px;
    width: 40px;
    text-align: center;
    margin-right: 2px;
}
-->
</style>
</head>
<body><form method="post" action="">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center" valign="middle"><span class="titler">short domain checker</span><br />
      <br />    </td>
  </tr>
  <tr>
    <td align="center" valign="middle"><table border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td valign="middle"><span class="text">Длина домена</span>&nbsp;</td>
        <td width="50" valign="middle"><input name="number" type="text" class="edit" id="number" value="<?=$number;?>" /></td>
        <td valign="middle"><span class="text">&nbsp;Количество доменов&nbsp;</span></td>
        <td width="50" valign="middle"><input name="domain_nums" type="text" class="edit" id="domain_nums" value="<?=$domain_nums;?>" /></td>
        <td valign="middle" class="text">Тип домена </td>
        <td valign="middle"><select name="domtype" class="selecte">
          <option value="1">Только буквы</option>
          <option value="2">Только цифры</option>
          <option value="0">Буквы и цифры</option>
        </select>        </td>
        <td valign="middle" class="text">Зона</td>
        <td valign="middle">
          <select name="zone" id="zone" class="selecte2">
            <option value="1">.ru</option>
            <option value="2">.su</option>
          </select>
        </label></td>
        <td width="50" valign="middle"><input name="submit" type="submit" class="buttoncheg" id="submit" value="Check" /></td>
      </tr>
    </table>
      <br /></td>
    </tr>
</table>
</form>
<?php

$number 
= intval($_POST['number']);          
$domain_nums = intval($_POST['domain_nums']);
$domtype = intval($_POST['domtype']);
$zone = intval($_POST['zone']);

if (
$zone == '1') {$zone = ".ru";}
if (
$zone == '2') {$zone = ".su";}
$whois = "whois.ripn.ru";                   
$not_found = "No entries found";    

if (
$number == '') {$number = 5;}
if (
$number < '0') {$number = 5;}
if (
$number == '2') {$number = 3;}
if (
$number > 20) {$number = 20;}  

if (
$domain_nums == '') {$domain_nums = 3;}
if (
$domain_nums < '0') {$domain_nums = 3;}       

function 
generate_domain($number, $type)  
{  
    if (
$type == '0') {
    
$arr = array(
    
'a','b','c','d','e','f',  
    
'g','h','i','j','k','l',  
    
'm','n','o','p','r','s',  
    
't','u','v','x','y','z',  
    
'1','2','3','4','5','6',  
    
'7','8','9','0');  
    }
    if (
$type == '1') {
    
$arr = array(
    
'a','b','c','d','e','f',  
    
'g','h','i','j','k','l',  
    
'm','n','o','p','r','s',  
    
't','u','v','x','y','z');  
    }
    if (
$type == '2') {
    
$arr = array(
    
'1','2','3','4',
    
'5','6','7','8',
    
'9','0');  
    }
    for(
$i = 0; $i < $number; $i++)  
    {   
        
$index = rand(0, count($arr) - 1);  
        
$dom .= $arr[$index];  
    }  
    return 
$dom;  
}

if(
$_POST['submit'])
{
    echo 
"<center><table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"tables\">
                <tr>
              <td width=\"100\" valign=\"middle\" class=\"text2\">Домен</td>
                 <td width=\"70\" valign=\"middle\" class=\"text3\">Годен до</td>
              <td width=\"150\" valign=\"middle\" class=\"text2\">Хост</td>
              <td width=\"70\" valign=\"middle\" class=\"text3\">Статус</td>
               </tr>
              </table></center>"
;
    for(
$i = 0; $i < $domain_nums; $i++)  
    {      
        
$domain = generate_domain($number,$domtype);
        
$domain = $domain.$zone;
        
$fp = fsockopen($whois, 43);
        
fputs($fp, "$domain\r\n");
        
$str = "";
        while(!
feof($fp))            
        {
            
$str .= fgets($fp,128);        
        }
        
fclose($fp);
        if(
preg_match("/Please try to connect later/is",$str)) 
        {
            die(
"<br><center><span class =\"error\" >Превышен лимит запросов к ".$whois." :(</span></center></body></html>");
        }
        
        if(!
preg_match("/".$not_found."/is", $str))
        {
            
preg_match("/paid-till:(.*?)\\n/is", $str, $edate);
            
preg_match("/nserver:(.*?)\\n/is", $str, $serv);
            
$edate  = $edate[1];
            
$serv   = str_replace("ns.", "",$serv[1]);     
            
$serv   = str_replace("ns1.", "",$serv);
            
$serv   = str_replace("ns2.", "",$serv);    
            
$serv   = str_replace("ns3.", "",$serv);
            
$serv   = str_replace("ns4.", "",$serv);
            
$serv   = str_replace("ns0.", "",$serv);
            
$status = "<span class =\"false\">Занят</span><br>";
        }
        else
        {
            
$edate  = " - ";
            
$serv   = " - ";
            
$status = "<span class =\"true\">Свободен</span><br>";
        }
        echo 
"<center><table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"tables\">
                <tr>
              <td width=\"100\" valign=\"middle\" class=\"text2\">
$domain</td>
                 <td width=\"70\" valign=\"middle\" class=\"text3\">
$edate</td>
              <td width=\"150\" valign=\"middle\" class=\"text2\">
$serv</td>
              <td width=\"70\" valign=\"middle\">
$status</td>
               </tr>
              </table></center>"
;
        
ob_flush();
        
flush();        
    }
}
?>
</body>
</html>

Последний раз редактировалось NNNS; 12.01.2008 в 10:27..
 
Ответить с цитированием