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

  #4  
Старый 16.07.2009, 23:41
sNt
Участник форума
Регистрация: 30.07.2008
Сообщений: 152
С нами: 9358231

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

To heretic1990:

PHP код:
<?php 

function error$error false 

    
header"Expires: Thu, 19 Feb 1998 13:24:18 GMT" ); 
    
header"Last-Modified: ".gmdate"D, d M Y H:i:s" )." GMT" ); 
    
header"Cache-Control: no-cache, must-revalidate" ); 
    
header"Cache-Control: post-check=0, pre-cache=0" ); 
    
header"Cache-Control: max-age=0" ); 
    
header"Pragma: no-cache" ); 
    
header"Content-Type: text/html; charset=windows-1251" ); 
    
$rand mt_rand099999 ); 
    echo 
"<html>\r\n 
<head>\r\n 
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1251\" /> 
<title>Накрутка хостов</title>\r\n 
</head>\r\n 
<body>\r\n 
<form action=\"test.php\" method=\"post\">\r\n"


    if ( 
$error == "agents" 
    { 
        echo 
"<b>Файл с браузерами недоступен или пуст!</b><br/>\n"
    } 
    if ( 
$error == "proxys" 
    { 
        echo 
"<b>Файл с прокси адресами недоступен или пуст!</b><br/>\n"
    } 
    echo 
"Количество хостов:<br/>\n"
    if ( 
$error == "kol" 
    { 
        echo 
"Мин:1 Макс:10000<br/>\n"
    } 
    echo 
"<input name=\"kol\" type=\"text\" value=\"100\" maxlength=\"5\" size=\"5\" /><br/>\r\nАдрес:<br/>\n"
    if ( 
$error == "link" 
    { 
        echo 
"Не корректно!<br/>\n"
    } 
    echo 
"<input name=\"link\" type=\"text\" value=\"http://\" maxlength=\"100\" /><br/>\r\nМакс. время соединений (секунд):<br/>\n"
    if ( 
$error == "time" 
    { 
        echo 
"Мин:1 Макс:30<br/>\n"
    } 
    echo 
"<input name=\"time\" type=\"text\" value=\"10\" maxlength=\"2\" size=\"2\" /><br/>\r\nМетод передачи:<br/>\n"
    if ( 
$error == "method" 
    { 
        echo 
"GET или POST<br/>\n"
    } 
    echo 
"<select name=\"method\">\r\n 
<option value=\"GET\">GET</option>\r\n 
<option value=\"POST\">POST</option>\r\n 
</select><br/>\r\nПротокол передачи:<br/>\n"

    if ( 
$error == "protokol" 
    { 
        echo 
"HTTP/1.0 или HTTP/1.1<br/>\n"
    } 
    echo 
"<select name=\"protokol\">\r\n 
<option value=\"HTTP/1.0\">HTTP/1.0</option>\r\n 
<option value=\"HTTP/1.1\">HTTP/1.1</option>\r\n 
</select><br/>\r\nСоединение:<br/>\n"

    if ( 
$error == "connection" 
    { 
        echo 
"Close или Keep-Alive<br/>\n"
    } 
    echo 
"<select name=\"connection\">\r\n 
<option value=\"Close\">Close</option>\r\n 
<option value=\"Keep-Alive\">Keep-Alive</option>\r\n 
</select><br/>\r\nВыбор телефона:<br/>\n"

    if ( 
$error == "agent" 
    { 
        echo 
"случайно или по порядку<br/>\n"
    } 
    echo 
"<select name=\"agent\">\r\n 
<option value=\"1\">случайно</option>\r\n 
<option value=\"2\">по порядку</option>\r\n 
</select><br/>\r\nВыбор прокси:<br/>\n"

    if ( 
$error == "proxy" 
    { 
        echo 
"случайно или по порядку<br/>\n"
    } 
    echo 
"<select name=\"proxy\">\r\n 
<option value=\"1\">случайно</option>\r\n 
<option value=\"2\">по порядку</option>\r\n 
</select><br/>\r\n<input name=\"submit\" type=\"submit\" name=\"start\" value=\"Крутить\">\r\n 
</form>\r\n 

</body>\r\n 
</html>\n"



error_reporting); 
$kol intval$_POST['kol'] ); 
$link $_POST['link']; 
$time intval$_POST['time'] ); 
$method $_POST['method']; 
$protokol $_POST['protokol']; 
$connection $_POST['connection']; 
$agent intval$_POST['agent'] ); 
$proxy intval$_POST['proxy'] ); 
$agents = array( ); 
$proxys = array( ); 
$agents file"agents.txt" ); 
$proxys file"proxys.txt" ); 
$cagents count$agents ); 
$cproxys count$proxys ); 
if ( empty( 
$kol ) || empty( $link ) || empty( $time ) || empty( $method ) || empty( $protokol ) || empty( $connection ) ) 

    
error( ); 

else if ( 
$kol || 10000 $kol 

    
error"kol" ); 

else if ( 
strlen$link ) < 15 || 100 strlen$link ) || substr$link0) !== "http://" 

    
error"link" ); 

else if ( 
$time || 30 $time 

    
error"time" ); 

else if ( 
$method || $method 

    
error"method" ); 

else if ( 
$protokol || $protokol 

    
error"protokol" ); 

else if ( 
$connection || $connection 

    
error"connection" ); 

else if ( 
$agent || $agent 

    
error"agent" ); 

else if ( 
$proxy || $proxy 

    
error"proxy" ); 

else if ( 
$cagents 

    
error"agents" ); 

else if ( 
$cproxys 

    
error"proxys" ); 

else 

    
$na = -1
    
$np = -1
    
$link substr$link); 
    
$host strtok$link"/" ); 
    if ( 
$host == false 
    { 
        
$host $link
    } 
    if ( 
$method == 
    { 
        
$method "GET"
    } 
    else 
    { 
        
$method "POST"
    } 
    if ( 
$protokol == 
    { 
        
$protokol "HTTP/1.0"
    } 
    else 
    { 
        
$protokol "HTTP/1.1"
    } 
    if ( 
$connection == 
    { 
        
$connection "Close"
    } 
    else 
    { 
        
$connection "Keep-Alive"
    } 
    
$i 0
    for ( ; 
$i $kol; ++$i 
    { 
        if ( 
$agent == 
        { 
            
$na mt_rand0$cagents ); 
        } 
        else 
        { 
            ++
$na
        } 
        if ( 
$proxy == 
        { 
            
$np mt_rand0$cproxys ); 
        } 
        else 
        { 
            ++
$np
        } 
        if ( 
$cagents <= $na 
        { 
            
$na 0
        } 
        if ( 
$cproxys <= $np 
        { 
            
$np 0
        } 
        
$a trim$agents[$na] ); 
        
$p trim$proxys[$np] ); 
        if ( empty( 
$a ) || empty( $p ) ) 
        { 
        } 
        else 
        { 

        } 
    } 
    
$text ""
    while ( !
feof$fo ) ) 
    { 
        
$text .= fgets$fo1024 ); 
    } 
    
$hd substr$text0strpos$text"\r\n\r\n" ) ); 
    
$text substr$textstrpos$text"\r\n\r\n" ) + ); 
    if ( 
$powered strtokstrstr$hd"X-Powered-By:" ), "\r\n" ) ) 
    { 
        
header$powered ); 
    } 
    if ( 
$cache strtokstrstr$hd"Cache-Control:" ), "\r\n" ) ) 
    { 
        
header$cache ); 
    } 
    if ( 
$expires strtokstrstr$hd"Expires:" ), "\r\n" ) ) 
    { 
        
header$expires ); 
    } 
    if ( 
$pragma strtokstrstr$hd"Pragma:" ), "\r\n" ) ) 
    { 
        
header$pragma ); 
    } 
    if ( 
$modified strtokstrstr$hd"Last-Modified:" ), "\r\n" ) ) 
    { 
        
header$modified ); 
    } 
    if ( 
$type strtokstrstr$hd"Content-Type:" ), "\r\n" ) ) 
    { 
        
header$type ); 
    } 
    if ( 
$disposition strtokstrstr$hd"Content-Disposition:" ), "\r\n" ) ) 
    { 
        
header$disposition ); 
    } 
    if ( 
$etag strtokstrstr$hd"ETag:" ), "\r\n" ) ) 
    { 
        
header$etag ); 
    } 
    if ( 
$ranges strtokstrstr$hd"Accept-Ranges:" ), "\r\n" ) ) 
    { 
        
header$ranges ); 
    } 
    exit( 
$text ); 


if(
$_POST['link']) {
$str=str_replace("http://"""$link);
$srv=substr($str,0,strpos($str,"/"));

for(
$i=0$i<$kol$i++) {
$fp fsockopen($srv'80'$er1$er2$time);     

if (
$fp
    {   
      
$hd  "".$method." ".$link." ".$protokol."\n"
      
$hd .= "Content-Length: 0\n\n";
      
$hd .= "Proxy-Connection: $connection\r\n"
      
$hd .= "User-Agent: Win98, MSIE\r\n\r\n";
   

      
fwrite($fp$hd);   
      
$line='';  
      while (!
feof($fp))  
      {   
        
$line .= fgets($fp1024);   
      }   
      
fclose($fp);   

       

            } 
            }
}

?>
Код просто ппц. Я чуть руки не сломал себе. Вообще не могу понять, как ты его писал? Сначала пишем, потом проверяем? Там столько трабл, то можно сделать вывод, что ты толком скрипт и не тестил, тупо отстрочил, а потом "что у меня не работает". Мой тебе совет: перепиши код, не позорься. Столько глупых затей реализовал, совершенно непонятных. Например: нафига при выборе той или иной функции, ты присваивал ей число (1 или 0), потом ещё делал распознание, что там там значит единица, что нолик, когда можно было бы сразу вставлять в отсылку заголовоков полученный результат? В общем, я плакаль. С таким кодом не каждый хочет иметь дело, так что тебе ОЧЕНЬ повезло.

Последний раз редактировалось sNt; 17.07.2009 в 15:58..
 
Ответить с цитированием