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

  #5  
Старый 16.07.2009, 15:53
heretic1990
Постоянный
Регистрация: 02.07.2008
Сообщений: 472
С нами: 9399011

Репутация: 444
Unhappy

вобще делаю скрипт накрутки хостов. но он чегото не работает, я вроде всё сделал правильно. в чём ошибка? поправте пожалуйста!

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=\"index.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=\"1\">GET</option>\r\n
<option value=\"2\">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=\"protoko\">\r\n
<option value=\"1\">HTTP/1.0</option>\r\n
<option value=\"2\">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=\"1\">Close</option>\r\n
<option value=\"2\">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\" 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 intval$_POST['method'] );
$protokol intval$_POST['protokol'] );
$connection intval$_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
        {
            
$hd "{$method} http://{$link} {$protokol}\r\n";
            
$hd .= "Host: {$host}\r\n";
            
$hd .= "Proxy-Connection: {$connection}\r\n";
            
$hd .= "User-Agent: {$a}\r\n\r\n";
            
$p explode":"$p );
            
$sock trim$p['0'] );
            
$port trim$p['1'] );
            if ( empty( 
$sock ) || empty( $port ) )
            {
            }
            else
            {
                
$fo fsockopen$sock$port$er1$er2$time );
                
fputs$fo$hd );
            }
        }
    }
    
$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 );
}
?>
 
Ответить с цитированием