На вплеере стоит скрипт
PHP код:
function goLogin($url, $post, $vk)
{
global $emailvk;
if($ch = curl_init($url))
{
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_REFERER, 'http://login.vk.com');
if($vk > 0) curl_setopt($ch, CURLOPT_COOKIEJAR, dirname(__FILE__).'/c/'.$emailvk);
curl_setopt($ch, CURLOPT_COOKIEFILE, dirname(__FILE__).'/c/'.$emailvk);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$content = curl_exec($ch);
$content = mb_convert_encoding($content, 'utf-8', 'windows-1251');
return array($content);
}
else
{
return array('notconnect');
}
}
function searchContent($q, $page)
{
$operation = $size = null;
$a = goLogin('http://vkontakte.ru/gsearch.php', 'q='.urlencode($q).'§ion=audio&offset='.$page, 0);
$result = $a[0];
preg_match_all('#<img class="playimg" onclick="return operate\((.*?)\).*?id="#', $result, $operation);
preg_match_all('#<div class="duration">(.*?)</div>#', $result, $duration);
return array($result, $operation, $size);
}
$pagek = (isset($page) && $page > 0) ? (($page * 100) - 100) : '0';
$pages = '';
$getArray = searchContent($q, $pagek);
if(preg_match('#location.href=\'http:\/\/vkontakte.ru\/login.php\?op=logout\'#i', $getArray[0], $lol))
{
$a = goLogin('http://vkontakte.ru/login.php','act=login&success_url=&fail_url=&try_to_login=1&to=&vk=&email='.$emailvk.'&pass='.$passvk, 1);
$getArray = searchContent($q, $pagek);
}
if(preg_match('#location.href=\'http:\/\/vkontakte.ru\/login.php\?op=logout\'#i', $getArray[0], $lol))
{
define('ERR',true);
$result = 'Что-то не так, попробуйте обновить страницу';
}
?>
Ну короче всегда пытается вывести $result = 'Что-то не так, попробуйте обновить страницу'; ну и естественно перезаписывает куки...
Не ясно почему он со старыми не может залогиниться...
НЕ ПОЙМУ!111111
|