########################## # Vkontakte Inviter By Chaаk ########################## set_time_limit(0); class vkInviter { private $accounts; #аккаунты private $proxy = false; #прокси private $cookies = array(); #кукисы private $friends = array(); #друзья private $gid; private function socket_do($action,$method,$header = false,$timeout = 10,$params = false,$follow = false,$cookie = false,$referer = false) { $ch = curl_init(); if(strtoupper($method) == 'GET') { $action .= '?'.$params; curl_setopt($ch,CURLOPT_URL,$action); curl_setopt($ch,CURLOPT_HTTPGET,1); } elseif(strtoupper($method) == 'POST') { curl_setopt($ch,CURLOPT_URL,$action); curl_setopt($ch,CURLOPT_POST,true); curl_setopt($ch,CURLOPT_POSTFIELDS,$params); } else { curl_setopt($ch,CURLOPT_URL,$action); } if($this->proxy) { curl_setopt($ch,CURLOPT_PROXY,$this->$proxy); } curl_setopt($ch,CURLOPT_RETURNTRANSFER,true); curl_setopt($ch,CURLOPT_FOLLOWLOCATION,$follow); curl_setopt($ch,CURLOPT_FAILONERROR,false); curl_setopt($ch,CURLOPT_HEADER,$header); curl_setopt($ch,CURLOPT_USERAGENT,'Opera/9.62 (Windows NT 6.0; U; ru) Presto/2.1.1'); curl_setopt($ch,CURLOPT_REFERER,$referer); curl_setopt($ch,CURLOPT_COOKIE,$cookie); curl_setopt($ch,CURLOPT_TIMEOUT,$timeout); $done = curl_exec($ch); curl_close($ch); return $done; } private function pregCookie($headers) { preg_match_all('#Set-cookie: (.*;)#UiS',$headers,$headers); $this->cookies[] = preg_replace('#remixlang=[0-9]+#','remixlang=0',implode('',$headers['1'])); } private function putText($text) { echo $text.' '; flush(); ob_flush(); } public function SetPref($gid,$accounts,$proxy = false) { $this->gid = $gid; $this->accounts = $accounts; $this->proxy = $proxy; } private function getFriends($num) { $res = $this->socket_do('http://pda.vkontakte.ru/write','POST',true,10,false,true,$this->cookies[$num]); preg_match_all('##UiS',$res,$friends); $this->friends[] = $friends['1']; } public function getCookies_N_Friends() { $this->putText('Начало авторизации аккаунтов...'); foreach($this->accounts as $acc) { list($email,$pass) = explode(':',trim($acc)); $res = $this->socket_do('http://pda.vkontakte.ru/login?pda=index&acknowledge=0','POST',true,10,"email=$email&pass=$pass",true); if(strstr($res,'302 Found') || strstr($res,'302 Moved')) { $this->pregCookie($res); } } sleep($this->delay); $this->putText('Авторизовано: '.count($this->cookies).' аккаунтов.'); $this->putText('Начало сбора друзей...'); foreach($this->cookies as $key => $cook) { $this->getFriends($key); } $frcount = 0; foreach($this->friends as $friends) { $frcount += count($friends); } $this->putText('Всего: '.$frcount.' друзей для приглашений... Начало приглашений'); sleep(2); } public function invite() { for($i = 0,$c = count($this->accounts); $i < $c; $i++) { $makestr = 'act=ainvitefriends&gid='.$this->gid; foreach($this->friends[$i] as $friend) { $makestr .= '&'.trim($friend).'=1'; } if(strstr($this->socket_do('http://vkontakte.ru/groups_ajax.php','POST',1,10,$makestr,1,$this->cookies[$i]),'ok')) { $this->putText('Отправлено - '.count($this->friends[$i]).' приглашений(я)...'); } else { $this->putText('Приглашения не отправлены.'); } sleep(4); } echo 'Закончено!'; } } if(!$_POST['start']) { ?> <center> <form action="" method="POST"> <table> <tr><td align="center">ID группы: </td><td><input type="text" name="gid" size="16"/></td></tr> <tr><td align="center">Proxy(не обяз.): </td><td><input type="text" name="proxy" size="16"/></td></tr> <tr><td colspan="2" align="center">Аккаунты:</td></tr> <tr><td colspan="2" align="center"><textarea name="accounts" rows="15" cols="50"></textarea> <tr><td colspan="2" align="center"><input type="submit" name="start" value="Разослать инвайты"/></td></tr> </table> </form> </center> } else { echo ' '; $vk = new vkInviter(); $vk->SetPref($_POST['gid'],explode("\n",trim($_POST['accounts'])),trim(@$_POST['proxy'])); $vk->getCookies_N_Friends(); $vk->invite(); echo ' '; } ?>
|