Просмотр файла check.php

Размер файла: 6.33Kb
<?php

/**
 * @Ylog2
 * @~SVS~ 2011
 */
//Заголовки
header("Cache-Control: no-store, no-cache, must-revalidate");// HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");// HTTP/1.0
header("Content-Type: text/html;charset=utf-8");
set_time_limit(0);
//Подключаемся к базе
include "connect.php";

 //Скрипс парсера доменов ваплог!)
 get_domain();
 /////////
 //Берем домен из Ваплога
 /////////
 function get_domain(){
    for($i=1000;$i<50000;$i++){
    $ch = curl_init('http://wap.waplog.net/ru/xhtml/stat/'.$i);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");  
curl_setopt($ch, CURLOPT_FAILONERROR, 1);  
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects  
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true); // return into a variable
    $out = curl_exec($ch);
    curl_close($ch);
    
    //echo $out;
    if(preg_match("/<a href=\"\/go\.shtml\?http:\/\/.*;([0-9]+)\">.*\.([A-z0-9_-]+\.[A-z]{2,5})<\/a>/i",$out,$domain)){
            //echo $o.'<br>';
            //echo $domain[2].'<br>';
            if(mysql_num_rows(mysql_query("SELECT `name` FROM `bad_domain` WHERE `name` = '".$domain[2]."'")) == 0){
                if(mysql_num_rows(mysql_query("SELECT `name` FROM `free_domain` WHERE `name` = '".$domain[2]."'")) == 0){
                     //Проверяем где домен
    $ch = curl_init('http://waplog.net/c.shtml?'.$domain[1]);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");  
curl_setopt($ch, CURLOPT_FAILONERROR, 1);  
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true); // return into a variable
    $out = curl_exec($ch);
    $info = curl_getinfo($ch);
    curl_close($ch);
                check_domain($domain[2],$domain[1],$info['url']); 
                //echo 'ok';
             //print_r($domain); 
             }  
            } 
         }else{
               //break;
    }
    }
 }
 
 
 //check_domain('tabor.ru',4325,'url');
 /////////
 //Функция проверки домена
 /////////
function check_domain($domain,$id_waplog,$url){
$ch = curl_init('http://whois.pp.ru/');
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");  
curl_setopt($ch, CURLOPT_FAILONERROR, 1);  
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects  
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true); // return into a variable
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "domain=".$domain."");
    $out = curl_exec($ch);
    curl_close($ch);
    //echo $out;
	preg_match("/<\/a> - ([0-9]+) | <a href=http:\/\/www\.google\.ru/si",$out,$tic);
	preg_match("/PR<\/a> - ([0-9]+) | <a href=\"http:\/\/web\.archive\.org/si",$out,$pr);
	//print_r($pr);
    if(preg_match("/<a href=https:\/\/dc\.nserver\.ru>/i",$out)){
        //Если домен свободен пишем в свободные
      mysql_query("INSERT INTO `free_domain` (`id` ,`name` ,`id_waplog`,`pr`, `tic`, `url`)VALUES (NULL , '".$domain."', '".$id_waplog."','".$pr."', '".$tic[1]."', '".$url."');");
      if(preg_match("/waplog\.net\/ru\/html/i",$url)){
        //Вызываем проверку домена
        ismail($domain);
      }
    }else{
        if(preg_match("/free-date<\/span>:     ([0-9]{4}\.[0-9]{2}\.[0-9]{2})/i",$out,$res)){
            $free = $res[1];
            
        }else{sec_dom($domain);}
        //print_r($res);
        //если занят пишем в занятые!)
      mysql_query("INSERT INTO `bad_domain` (`id` ,`name` ,`id_waplog`,`free_date`,`pr`, `tic`, `url`)VALUES (NULL , '".$domain."', '".$id_waplog."', '".$free."','".$pr."', '".$tic[1]."', '".$url."');");
    }
    
}

//ismail('kot-net.org');

function ismail($domen){
    $file = fopen('mailname.txt', 'r') or die("Can't open file!");
    $a = fread($file,filesize('mailname.txt'));
    $b = explode("\r\n",$a);
    $colb = count($b);
    for($i=0;$i<$colb;$i++){
      //echo $b[$i].'@'.$domen.'<br>';
      mailcheck($b[$i].'@'.$domen,$domen);     
    }  
	fclose($file);
	preg_match("/([0-9A-z]+)\..*/i",$domen,$ux);
	mailcheck($ux[0].'@'.$domen,$domen);
	mailcheck($ux[1].'@'.$domen,$domen);
    
}

//mailcheck('[email protected]');
function mailcheck($mail,$domen){
    $uagent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)";
    //echo $mail.'<br>';
    $ch = curl_init('http://waplog.net/ru/html/forgot.shtml?');
  //curl_setopt($ch, CURLOPT_URL, $url);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);   // возвращает веб-страницу
  curl_setopt($ch, CURLOPT_HEADER, 0);           // не возвращает заголовки
  //curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);   // переходит по редиректам
  curl_setopt($ch, CURLOPT_ENCODING, "");        // обрабатывает все кодировки
  curl_setopt($ch, CURLOPT_USERAGENT, $uagent);  // useragent
  curl_setopt($ch, CURLOPT_MAXREDIRS, 10);       // останавливаться после 10-ого редиректа
  curl_setopt($ch, CURLOPT_POSTFIELDS, "email=".$mail."&send= получить пароль ");
  $content = curl_exec( $ch );
  curl_close($ch);
  //echo $content;
  
if(preg_match("/E-mail: <span style=\"color: #ff0000\">".$mail."<\/span>/i",$content)){  
    //echo 1;
mysql_query("UPDATE `free_domain` SET `mail` = '".$mail."' WHERE `name` = '".$domen."' LIMIT 1 ;");
//echo $mail.'<br/>';
return 1;
}
}

//////////////////////////
//sec_dom('fanok.ru');

function sec_dom($domain){
$ch = curl_init('http://nic.ru/whois/?query='.$domain);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");  
curl_setopt($ch, CURLOPT_FAILONERROR, 1);  
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects  
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true); // return into a variable
//curl_setopt($ch, CURLOPT_POST, 1);
//curl_setopt($ch, CURLOPT_POSTFIELDS, "domain=".$domain."");
    $out = curl_exec($ch);
    curl_close($ch);
	preg_match("/free-date:.*([0-9]{4,}\.[0-9]{2,}\.[0-9]{2,})<br>/si",$out,$free);
//print_r($free);
return $free = $free[1];
}
?>