Файл: inc/tools/proxy_checker/check.php
Строк: 54
<cron>
<?php
if($typescript=='local')
{
if(!$_POST[start]) exit;
extract($_POST);
$scriptpath='./proxy_checker/';
}
else
{
$scriptpath='./';
include_once('./config.php');
}
if($clearfile) @unlink($scriptpath.$file2);
$proxies=array_map("trim", file($scriptpath.$file1));
shuffle($proxies);
echo "http://".$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]."<br>";
// Определяем свой айпи
$svoiip=$_SERVER["SERVER_ADDR"];
foreach ($proxies as $proxy)
{
ob_flush(); flush();
echo $proxy." ";
$ch = curl_init( );
curl_setopt( $ch, CURLOPT_URL, "http://".$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]);
curl_setopt( $ch, CURLOPT_TIMEOUT, 10 );
curl_setopt( $ch, CURLOPT_USERAGENT, "Ua");
curl_setopt( $ch, CURLOPT_HEADER, 0 );
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 0 );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
if($check_refer)curl_setopt( $ch, CURLOPT_REFERER, "some_referer" );
if($check_post)curl_setopt( $ch, CURLOPT_POST, 1 );
if($check_post)curl_setopt( $ch, CURLOPT_POSTFIELDS, "some_post=data" );
if($check_cookies)curl_setopt( $ch, CURLOPT_COOKIE, "some_cookie=kuka" );
curl_setopt( $ch, CURLOPT_PROXY, $proxy);
$content = curl_exec($ch);
$connect = curl_getinfo($ch, CURLINFO_CONNECT_TIME );
echo "<font color=red>Connect time: ".$connect."</font> " ;
if (is_float($connect) && $connect!=0)
{
$vseovremea = curl_getinfo($ch, CURLINFO_TOTAL_TIME );
// Проверяем, передались ли данные методом пост
if($check_post) if (strpos($content, "some_post" )) echo "POST=OK "; else {echo "POST=NO "; $bad=1;}
// Проверяем, передаёт ли прокся рефера
if($check_refer) if (strpos($content, "some_referer" )) echo "REFER=OK "; else {echo "REFER=NO "; $bad=1;}
// Проверяем передаваемость куков
if($check_cookies) if (strpos($content, "some_cookie" )) echo "COOKIE=OK "; else {echo "COOKIE=NO "; $bad=1;}
// Если айпи обраружен, значит
if (@substr_count($content, $svoiip)) {echo "Proxy Is transparent"; if($check_anon) $bad=1;}
// Проверяем все возможные указатели на пользование проксей
if ( preg_match_all( "|([^rn]+)=([^rn]+)|", $content, $m, PREG_SET_ORDER ) )
{
$capul=array("HTTP_X_FORWARDED_FOR", "HTTP_X_FORWARDED", "HTTP_X_COMING_FROM", "HTTP_FORWARDED_FOR", "HTTP_FORWARDED", "HTTP_COMING_FROM", "HTTP_VIA", "HTTP_XROXY_CONNECTION", "HTTP_PROXY_CONNECTION");
foreach ( $m as $v )
{
if (in_array($v[1], $capul)) $anonim = 1;
}
}
if ($anonim==1)
{
echo "Proxy is Anonymous";
unset($anonim);
}
else echo "Proxy is Elite";
if(!$bad)
{
$fs=fopen($scriptpath.$file2, 'a');
fwrite($fs, $proxy."rn");
fclose($fs);
}
unset($bad);
}
else echo "Bad Proxy";
echo "<br>";
curl_close( $ch );
}
?>