Antichat снова доступен.
Форум Antichat (Античат) возвращается и снова открыт для пользователей.
Здесь обсуждаются безопасность, программирование, технологии и многое другое.
Сообщество снова собирается вместе.
Новый адрес: forum.antichat.xyz
 |
|

13.12.2009, 22:53
|
|
Постоянный
Регистрация: 15.06.2007
Сообщений: 527
Провел на форуме: 1734541
Репутация:
214
|
|
античат не форум экстрасенсов (с)
код в студию
|
|
|

13.12.2009, 22:54
|
|
Познающий
Регистрация: 11.11.2008
Сообщений: 77
Провел на форуме: 1144288
Репутация:
99
|
|
хорошо бы код выложить...
возможно если скрипт работает через curl то надо добавить строку:
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
|
|
|

13.12.2009, 22:55
|
|
Познающий
Регистрация: 26.11.2008
Сообщений: 40
Провел на форуме: 1410006
Репутация:
4
|
|
При просмотре заголовков видно iframe но не понятно как сделать так чтобы он не редиректил на контакт.
Код HTML:
Смотрим есть ли новые друзья ..........HTTP/1.1 200 OK
Date: Mon, 14 Dec 2009 02:40:36 GMT
Server: nginx/0.7.59
Content-Type: text/html; charset=windows-1251
X-Powered-By: PHP/5.2.6-1+lenny3
Pragma: no-cache
Cache-control: no-store
P3P: CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"
Vary: Accept-Encoding
Content-Length: 1058
Connection: close
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=windows-1251" />
<script>
var t = setTimeout("location.href='http://vkontakte.ru/login.php?op=logout'", 7000);
</script>
</head>
<body>
<div>
<img src="http://vkontakte.ru/images/progress.gif">
</div>
<form id="f" name="f" method="post" action="http://vkontakte.ru/friends.php?filter=requests">
<input type='hidden' name='filter' value='requests' /><input type='hidden' name='IP_ADDRESS' value='210.32.200.95' /><input type='hidden' name='request_method' value='get' /><input type='hidden' name='pda' value='' />
</form>
<iframe name="mf" onload="try{if (this.contentWindow.location.href.indexOf('slogin') != -1) {clearTimeout(t); if (this.contentWindow.location.href.indexOf('nonenone') != -1) {location.href='http://vkontakte.ru/login
|
|
|

13.12.2009, 23:03
|
|
Познающий
Регистрация: 11.11.2008
Сообщений: 77
Провел на форуме: 1144288
Репутация:
99
|
|
а зачем выводит в браузер html?
Парсить страницу надо, а не выводить.
|
|
|

13.12.2009, 23:10
|
|
Познающий
Регистрация: 26.11.2008
Сообщений: 40
Провел на форуме: 1410006
Репутация:
4
|
|
Просто скрипт подвисает и я хотел посмотреть в каком месте это происходит.
|
|
|

13.12.2009, 23:18
|
|
Познающий
Регистрация: 26.11.2008
Сообщений: 40
Провел на форуме: 1410006
Репутация:
4
|
|
Дайте советы по увеличению скорости данного скрипта и ошибкам.
Файл index.php
PHP код:
<?php
set_time_limit( 1200 );
include( 'function.inc' );
print date( "H:i:s", time() ) ."<br />"; flush();
$TimeGrab = file ( $TimeGrabProx );
if ( $TimeGrab[0] <= date ( 'd/m/Y H:i:s' , time() ) )
{
print "Обнавляем прокси ... "; flush();
if ( grab ( $proxing, $TimeGrabProx ) !== false )
{
print "Ok!<br />"; flush();
$proxing = file ( 'proxy.txt' );
$count = count ( $proxing );
$display[] = '['.date( "d-m-Y H:i:s", time() ) .']Обновили прокси! '.$count." штук!\r\n";
log_file ( $display, $loger, $display_mess );
unset ( $display );
}
else
{
$display[] = '['.date( "d-m-Y H:i:s", time() ) ."]Ошибка обнавления прокси!\r\n";
log_file ( $display, $loger, $display_mess);
exit();
}
sleep( 10 );
}
$proxing = file ( 'proxy.txt' );
$count = count ( $proxing );
$display[] = "Run friends [".date( "d-m-Y H:i:s", time() ) ."]";
/**********************************************************
/*Заходим в аккаунт
/***********************************************************/
for ($k = 0; $k < count( $acc ); $k++ )
{
if ( $k == 0 )
{
$proxy = $proxing[0];
}
list($nic, $pass, $stst ) = split( ":", $acc[$k] );
$display[] = " << " . $nic .":" .$proxy." >> ";
$data_auth = "?act=login&email=".$nic."&pass=".$pass."&expire=&vk=1";
$delling = false;
if ( $message == 1 ) print "Проверяем <b>" .$nic. "</b> на работоспасобность ...";
do
{
$connect = get_page_html( 'http://vkontakte.ru/login.php', 'http://login.vk.com/', $proxy, $data_auth, 1 );
if ( strstr ( $connect, 'HTTP/1.1 200 OK') !== false xor strstr ( $connect, 'HTTP/1.0 200 OK') !== false )
{
if ( strstr ( $connect, 'HTTP/1.1 302') !== false )
{
//=========================================//
if ( $message == 1 ) print " ok ! <br />"; flush();
preg_match('#\d+#',$connect,$id);
echo $res[0];
//=========================================//
preg_match_all('#Set-cookie: (.*?;) ex#UiS', $connect, $cookie );
if ( !empty( $cookie[1][1] ) )
{
for ( $c = 0; $c < count( $cookie[1] ); $c++)
{
$Cookies .= $cookie[1][$c];
}
if ( strstr ( $Cookies , 'remixsid' ) !== true )
{
$Cookies .= 'remixlang=0;remixchk=5;';
}
/*||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||*/
print "Делаем анкету онлайн ..."; flush();
$OnLineOk = false;
do
{
$OnLine = get_page_html( 'http://vkontakte.ru/profile.php', 'http://login.vk.com/?act=login', $proxy, NULL, 1, $Cookies );
if ( strstr ( $OnLine, '/profile.php' ) !== false )
{
//print $OnLine . "<br />"; flush();
print " Ok! <br />"; flush();
$OnLineOk = true;
}
else
{
if ( $proxing[$count-1] == $proxy )
{
print "Идем по списку прокси с начала!<br />\n";
$proxy = reset ( $proxing );
}
else
{
if ( $message == 1 ) print "."; flush();
$proxy = next( $proxing );
}
}
}
while ( !$OnLineOk );
/*||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||*/
//=========================================//
if ( $message == 1 ) print " Смотрим есть ли новые друзья ..."; flush();
$ProfileOk = false;
$fid_count = 0;
do
{
$ProFile = get_page_html( 'http://vkontakte.ru/friends.php?filter=requests', 'http://vkontakte.ru/profile.php', $proxy, NULL, 1, $Cookies );
//print $ProFile; flush();
if ( strstr ( $ProFile, 'http://vkontakte.ru/id1' ) !== false )
{
if ( strstr ( $ProFile, 'Location: /friends.php' ) !== false )
{
print "Заявок нет<br />\n"; flush();
}
else
{
preg_match_all( '#.*\[\[(.*?)\]\],.*#', $ProFile, $FrStr );
preg_match( '#.*\'hash\':\'(.*?)\'.*#', $ProFile, $Hash );
$FrStrExplode = explode( "],[", $FrStr[1][0] );
print " " . count ( $FrStrExplode ) ." в друзья!<br />"; flush();
foreach ( $FrStrExplode as $Fr )
{
preg_match( '#(\d{0,12}),\"(.*?)\",.*#', $Fr, $FrWelId );
print $FrWelId[1]; flush();
$WelcPost = 'fid='.$FrWelId[1].'&act=accept_friend&hash='.$Hash[1].'&cats=1';
/* Приглашаем */
$GoWelk = false;
do
{
$WelkResp = get_page_html( 'http://vkontakte.ru/friends_ajax.php', 'http://vkontakte.ru/friends.php?filter=requests', $proxy, $WelcPost, 1, $Cookies );
if ( strstr ( $WelkResp, 'Заявка принята' ) !== false xor strstr ( $WelkResp, 'Request Accepted' ) !== false xor strstr ( $WelkResp, 'Заявку прийнято' ) !== false)
{
print " Ok <br />\n"; flush();
$GoWelk = true;
}
else
{
if ( $proxing[$count-1] == $proxy )
{
print "Идем по списку прокси с начала!<br />\n";
$proxy = reset ( $proxing );
}
else
{
if ( $message == 1 ) print "."; flush();
$proxy = next( $proxing );
}
}
}
while ( !$GoWelk );
/* */
}
}
$ProfileOk = true;
}
else
{
if ( $proxing[$count-1] == $proxy )
{
print "Идем по списку прокси с начала!<br />\n";
$proxy = reset ( $proxing );
}
else
{
if ( $message == 1 ) print "."; flush();
$proxy = next( $proxing );
}
}
}
while ( !$ProfileOk );
$display[] = "[ " . count ( $FrStrExplode ) . " ] new friends - is accepted ! ";
/*||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||*/
$delling = true;
}
else
{
if ( $proxing[$count-1] == $proxy )
{
print "Идем по списку прокси с начала!<br />\n";
$proxy = reset ( $proxing );
}
else
{
if ( $message == 1 ) print "."; flush();
$proxy = next( $proxing );
}
}
/////////////////////////////////////////////
}
elseif ( strstr ( $connect, 'failed') !== false )
{
if ( $message == 1 ) print " Удален ! <br />"; flush();
$DellAcc = fopen ( $DelLog, 'a+' );
if ( $DellAcc )
{
$RecordDellAcc = "[ ".date( "d-m-Y H:i:s", time() ). " ] " . $nic . " Сайт ответил: анкета удалена.\n";
fputs( $DellAcc, $RecordDellAcc );
}
else
{
if ( $message == 1 ) print "Не смогли записать в файл удаленную анкету<br />";
flush();
}
fclose( $DellAcc );
$delling = true;
}
elseif ( strstr ( $connect, 'Enter code') !== false )
{
if ( $message == 1 ) print " требует ввода капчии, спим 30 сек ...<br />"; flush();
if ( $proxing[$count-1] == $proxy )
{
print "Идем по списку прокси с начала!<br />\n";
$proxy = reset ( $proxing );
}
else
{
$proxy = next( $proxing );
}
sleep( 30 );
if ( $message == 1 ) print " пробуем снова ..."; flush();
}
else
{
if ( $proxing[$count-1] == $proxy )
{
print "Идем по списку прокси с начала!<br />\n";
$proxy = reset ( $proxing );
}
else
{
if ( $message == 1 ) print "."; flush();
$proxy = next( $proxing );
}
}
}
else
{
if ( $proxing[$count-1] == $proxy )
{
print "Идем по списку прокси с начала!<br />\n";
$proxy = reset ( $proxing );
}
else
{
if ( $message == 1 ) print "."; flush();
$proxy = next( $proxing );
}
}
}
while ( !$delling );
$Cookies = '';
sleep( 5 );
}
$display[] = $k . " vsego onlain акаунта(ов) [".date( "d-m-Y H:i:s", time() ) ."]\r\n";
print date("H:i:s", time()) . "<br />"; flush();
if ( $message == 1 )
{
print log_file ( $display, $loger, $display_mess );
}
?>
Файл function.inc
PHP код:
<?php
date_default_timezone_set( 'Europe/Kiev' );
$display = array(); //Массив с сообщениями
$loger = 1; // 1 Включает зпись логов, 0 выключает;
$display_mess = 0; // 1 Включает вывод сообщения о прделоной работе, 0 выключает;
$message = 1;// 1 Включает вывод сообщения о ходе работы, 0 выключает;
// Файл счетчик обновления прокси
if ( file_exists( 'count_prox.dat' ) )
{
$TimeGrabProx = 'count_prox.dat';
}
else
{
$CreaetTimeGrabProx = fopen( 'count_prox.dat', 'w+' );
if ( $CreaetTimeGrabProx )
{
chmod( 'count_prox.dat', 0666 );
print "Создали файл 'count_prox.dat' <br />"; flush();
}
fclose ( $CreaetTimeGrabProx );
$TimeGrabProx = 'count_prox.dat';
}
// Файл удаленных анкет
if ( file_exists( 'DellAcc.txt' ) )
{
$DelLog = 'DellAcc.txt';
}
else
{
$CreaetDelLog = fopen( 'DellAcc.txt', 'w+' );
if ( $CreaetDelLog )
{
chmod( 'DellAcc.txt', 0666 );
print "Создали файл 'DellAcc.txt' <br />"; flush();
}
fclose ( $CreaetDelLog );
$DelLog = 'DellAcc.txt';
}
if ( file_exists( 'proxy.txt' ) )
{
$proxing = file ( 'proxy.txt' ); // Файл с прокси
}
else
{
exit ( 'Нет файла прокси!');
}
///////////
if ( file_exists( 'acc.inc' ) )
{
$acc = file ( 'acc.inc' ); // Файл с анкетами
}
else
{
exit ( 'Нет файла с аккаунтами!');
}
function count_prox ( $TimeGrabProx, $Time=7200 )
{
$acc_rec = fopen ( $TimeGrabProx, "w+" );
if ( flock( $acc_rec, LOCK_EX ) )
{
fseek($acc_rec, 0 );
fputs( $acc_rec, date ( "d/m/Y H:i:s", ( time () + $Time ) ) );
flock( $acc_rec, LOCK_UN);
}
fclose ($acc_rec);
}
function log_file ( $var, $stat, $display_mess ) // Функция для ведения лог файла
{
if ( $stat == 1 )
{
if ( file_exists( 'log_file.txt' ) )
{
$log_file = fopen ( 'log_file.txt', "a+" ) or die( "Не могу открыть log_file.txt" );
}
else
{
$log_file = fopen ( 'log_file.txt', "a+" ) or die( "Не могу открыть log_file.txt" );
if ( $log_file )
{
chmod( 'log_file.txt', 0666 );
}
}
if ( flock( $log_file, LOCK_EX ) )
{
rewind ( $log_file );
fputs( $log_file, @implode( " ", $var ) );
flock( $log_file, LOCK_UN);
}
else
{
return "Не могу запереть файл";
}
fclose ( $log_file );
}
if ( $display_mess == 1 )
{
$del = array_shift ( $var );
$del = array_pop ( $var );
return @implode ( " ", $var ) . flush();
}
}
function get_page_html( $url, $Refer='', $proxy='', $post='', $num='', $Cookie='' )
{
$agent="Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)";
$curltop = curl_init();
if ( !empty ( $proxy ) )
{
curl_setopt( $curltop, CURLOPT_PROXY, $proxy );
}
curl_setopt( $curltop, CURLOPT_URL, $url );
if ( !empty( $Refer ) )
{
curl_setopt( $curltop, CURLOPT_REFERER, $Refer );
}
curl_setopt( $curltop, CURLOPT_USERAGENT, $agent );
curl_setopt( $curltop, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt( $curltop, CURLOPT_FOLLOWLOCATION, 1 );
if ( empty( $Cookie ) )
{
$cookiefile = 'cookie.inc';
if ( !file_exists( $cookiefile ) )
{
$handle = fopen( $cookiefile, 'w' );
chmod( 'cookie.inc', 0666 );
fclose( $handle );
}
curl_setopt( $curltop, CURLOPT_COOKIEFILE, $cookiefile );
curl_setopt( $curltop, CURLOPT_COOKIEJAR, $cookiefile );
}
else
{
curl_setopt( $curltop, CURLOPT_COOKIE, $Cookie );
}
curl_setopt( $curltop, CURLOPT_TIMEOUT, 15 );
if ( $num == 1 )
{
curl_setopt( $curltop, CURLOPT_HEADER, 1 );
}
if ( !empty( $post ) )
{
curl_setopt( $curltop, CURLOPT_POST, 1 );
curl_setopt( $curltop, CURLOPT_POSTFIELDS, $post );
}
$html = curl_exec( $curltop );
//echo $html;
curl_close ( $curltop );
return !empty( $html ) ? $html : false;
}
function grab ( $proxing, $TimeGrabProx )
{
$FileRezer = file ( 'proxy.txt' );
$file_prox = fopen ( 'proxy.txt', 'w+' );
flock( $file_prox, LOCK_EX );
$ArrayLinc[] = 'http://freeproxylist.org/en/free-proxy-list.htm';
for ( $p = 1; $p <= 50; $p ++ )
{
$ArrayLinc[$p] = 'http://freeproxylist.org/en/free-proxy-list.htm?index='.$p ;
}
foreach ( $ArrayLinc as $key => $Linc )
{
if ( $key == 0 )
{
$PostSend = 'cc=any&ssl=any&speed=0&port=any&connect=any&ping=15.0000&type=any&post=any&uptime=0§ion=both&codeen=any&interval=360&userip=94.178.217.103&code=AW1VfWYjMueusyuh&filter=save+and+apply+filter+options';
}
else
{
$PostSend = null;
}
$Prox = get_page_html ( Null, $Linc, Null, Null, $PostSend, 0 );
if ( !empty( $Prox ) )
{
preg_match_all( "/(\d{0,3}\.\d{0,3}\.\d{0,3}\.\d{0,3}:\d{0,6})/", $Prox, $ProxSort );
if ( !empty ( $ProxSort[1][0] ) )
{
//print $Linc ." Ok!<br />"; flush();
for ( $i = 0; $i < count ( $ProxSort[1] ); $i ++ )
{
fwrite( $file_prox, $ProxSort[1][$i]."\n" );
}
$prox_url_ok = true;
}
}
else
{
if ( ( $p - 1 ) == $key )
{
if ( filesize( 'proxy.txt' ) <= 10 )
{
fwrite( $file_prox, @implode( "", $FileRezer ) );
$prox_url_ok = false;
}
}
}
}
flock( $file_prox, LOCK_UN);
fclose( $file_prox );
count_prox ( $TimeGrabProx );
return $prox_url_ok;
}
?>
|
|
|

14.12.2009, 01:39
|
|
Banned
Регистрация: 02.12.2009
Сообщений: 23
Провел на форуме: 48201
Репутация:
-55
|
|
как узнать ПО сервера (из заголовка) средсвами ПХП. т.е. надо написать скрипт который читает загаловок сервера.
|
|
|

14.12.2009, 08:11
|
|
Познавший АНТИЧАТ
Регистрация: 27.04.2007
Сообщений: 1,044
Провел на форуме: 3660186
Репутация:
905
|
|
PHP код:
<?php
$url = 'http://linux.org.ru/';
$c = curl_init ();
curl_setopt ($c, CURLOPT_URL, $url);
curl_setopt ($c, CURLOPT_HEADER, 1);
curl_setopt ($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($c, CURLOPT_REFERER, $url);
curl_setopt ($c, CURLOPT_USERAGENT, 'Mozilla/5.0');
curl_setopt ($c, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt ($c, CURLOPT_NOBODY, 1);
$res = curl_exec ($c);
curl_close ($c);
preg_match ('/Server:\s+(.+?)\r\n/', $res, $m);
echo $m[1];
?>
|
|
|

14.12.2009, 21:00
|
|
Участник форума
Регистрация: 24.08.2009
Сообщений: 145
Провел на форуме: 285318
Репутация:
17
|
|
Подскажите пожалуйста,это вроде как к регуляркам относится!
В общем есть переменная,получаем через POST пример:
я делаю проверку
PHP код:
if ($param == 'Значение')
{
действие
}
Но проблема в том,что первая часть $param постоянная,к примеру setname,а вторая постоянно меняется и содержит она цифры и буквы.
К примеру так
Код:
setname vasyapupkin123
Можно как-нибудь определить или понять что переменная содержит setname A-Z;0-9 или что-то подобное..заранее спасибо
|
|
|

14.12.2009, 21:06
|
|
Reservists Of Antichat - Level 6
Регистрация: 23.08.2007
Сообщений: 1,237
Провел на форуме: 18127311
Репутация:
1676
|
|
Наверное так
PHP код:
<?php
if(preg_match('/^setname [0-9a-z]+$/i', $param))
{
действие
}
?>
|
|
|
|
 |
|
|
Здесь присутствуют: 1 (пользователей: 0 , гостей: 1)
|
|
|
|