поисковик музыки (парсер мп3 вконтакте)

Тема в разделе "PHP", создана пользователем Arioh, 19 май 2012.

Статус темы:
Закрыта.
Модераторы: latteo
  1. Arioh

    Arioh Создатель

    Регистр.:
    4 июл 2011
    Сообщения:
    38
    Симпатии:
    10
    всем привет! нашел поисковик музыки (парсер мп3 вконтакте) но после установки не ищет песни! вроде дело в файле functions.php

    кто подскажет в чем трабла?

    Код:
    <?php
    if (!defined(FromIndex)) die("Access Denied.");
     
    $start_time = microtime();
    $start_array = explode(" ",$start_time);
    $start_time = $start_array[1] + $start_array[0];
     
    class database {
      function connect(){
      global $db_user, $db_password, $db_hostname, $db_name;
      $ret = @mysql_connect($db_hostname, $db_user, $db_password);
      if (!$ret) die ("Cannot connect to the database.");
      mysql_query('SET NAMES cp1251');
      $ret = @mysql_select_db($db_name);
      if (!$ret) die ("Cannot select database : ". $db_name . ".");
    }
      function execute($sql_query) {
      global $sql_count;
      $sql_count++;
      return mysql_query($sql_query);           
    }}
     
    function gencode($lcode) {
      $out=NULL;
      for ($k=0; $k<$lcode ; $k++) {           
      $temp = rand(1,10);     
      if ($temp <= 3) $out .= chr(rand(48,57));
      else if ($temp <= 6) $out .= chr(rand(65,90));
      else if ($temp <= 10) $out .= chr(rand(97,122));               
    } 
    return $out;
    }
     
    function udate($format, $utimestamp = null)
    {
        if (is_null($utimestamp))
            $utimestamp = microtime(true);
     
        $timestamp = floor($utimestamp);
        $milliseconds = round(($utimestamp - $timestamp) * 1000000);
     
        return date(preg_replace('`(?<!\\\\)u`', $milliseconds, $format), $timestamp);
    }
     
    function account(){
      global $accounts;
      $cookie_str = 'remixchk=5; remixlang=3; remixnews_privacy_filter=0; remixap=1;'; 
      $file = file_exists($accounts) ? file($accounts) : '';
      if($file){
      $select = $file[mt_rand(0, count($file)-1)];
      $exp = explode(':', $select);
      $mail = trim($exp[0]);
      $pass = trim($exp[1]);
     
      $ch = curl_init();
      curl_setopt($ch, CURLOPT_HEADER, 1); 
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);   
      curl_setopt($ch, CURLOPT_POST, 1);
      curl_setopt($ch, CURLOPT_POSTFIELDS, "email=".$mail."&pass=".$pass);
      curl_setopt ($ch, CURLOPT_URL, 'http://login.vk.com/?act=login');
      $body = curl_exec($ch);
     
      preg_match ("|<input type='hidden' name='s' id='s' value='([a-z0-9]*)|is", $body, $arr);
      $cookie_str = $cookie_str.'remixsid='.$arr[1];
      $post_str = 'act=change_language&m=16&lhash=47624&language=3';
     
      curl_setopt($ch, CURLOPT_COOKIE, $cookie_str);
      curl_setopt($ch, CURLOPT_REFERER, "http://vk.com/settings.php");
      curl_setopt($ch, CURLOPT_URL, 'http://vk.com/settings.php');
      curl_setopt($ch, CURLOPT_POST, 1);
      curl_setopt($ch, CURLOPT_POSTFIELDS, $post_str);
      $body = curl_exec($ch);
     
      curl_close($ch);
     
      preg_match ("|<input type='hidden' name='s' id='s' value='([a-z0-9]*)|is", $body, $arr);
     
      return $cookie_str; 
      }else return false;
    }
     
    function conn($q, $page){
      if(empty($page) || $page <= 1) $page = 0;
      else $page = ($page.'00' - 100);
      $q = 'section=audio&q='.urlencode($q).'&offset='.$page;
      $connection = curl_init(); 
      curl_setopt($connection, CURLOPT_HEADER, 1); 
      curl_setopt($connection, CURLOPT_RETURNTRANSFER, 1); 
      curl_setopt($connection, CURLOPT_POST, 1); 
      curl_setopt($connection, CURLOPT_POSTFIELDS, "referer=http://vk.com");
      curl_setopt($connection, CURLOPT_COOKIE, account() );
      curl_setopt($connection, CURLOPT_URL, 'http://vk.com/gsearch.php?'.$q.''); 
      $all = curl_exec($connection); 
      curl_close($connection);
      eregi('<div id="searchContent">(.*)<div id="boxHolder">', $all, $matches);
      return stripos($matches[1], 'No audios with') ? false : $matches[1];
    }
     
     
    function pages($str, $page, $q){
      // global $self;
      if(preg_match('/<ul class="pageList">(.+)<li/is', $str)){
      $total = 25; //Сколько выводить страниц
      $page = empty($page) || $page <= 1 || $page > $total ? 1 : $page;
      $back1 = '<li class="pages_item"><a class="pages_link" href="'.$sittings[site_url].'?q='.$q.'&amp;page='.($page - 1).'">'.($page - 1).'</a></li>';
      $back2 = '<li class="pages_item"><a class="pages_link" href="'.$sittings[site_url].'?q='.$q.'&amp;page='.($page - 2).'">'.($page - 2).'</a></li>';
      $back3 = '<li class="pages_item"><a class="pages_link" href="'.$sittings[site_url].'?q='.$q.'&amp;page='.($page - 3).'">'.($page - 3).'</a></li>';
      $forw1 = '<li class="pages_item"><a class="pages_link" href="'.$sittings[site_url].'?q='.$q.'&amp;page='.($page + 1).'">'.($page + 1).'</a></li>';
      $forw2 = '<li class="pages_item"><a class="pages_link" href="'.$sittings[site_url].'?q='.$q.'&amp;page='.($page + 2).'">'.($page + 2).'</a></li>';
      $forw3 = '<li class="pages_item"><a class="pages_link" href="'.$sittings[site_url].'?q='.$q.'&amp;page='.($page + 3).'">'.($page + 3).'</a></li>';
      if(empty($page) || $page <= 1){
      $minus = '';
      $first = '';
      }else{
      $minus = '<li class="pages_item"><a class="pages_link" href="'.$sittings[site_url].'?q='.$q.'&amp;page='.($page - 1).'" title="Предыдущая"><img src="'.$url.'theme/mytheme/img/32.png" alt="&lt;" class="toolbar_button" title="Предыдущая страница"/></a></li>';
      $first = '<li class="pages_item"><a class="pages_link" href="'.$sittings[site_url].'?q='.$q.'&amp;page=1" title="Первая страница"><img src="'.$url.'theme/mytheme/img/38.png" alt="&gt;|" class="toolbar_button" title="Первая страница"/></a></li>';
      }
      if($page == $total){
      $plus = '';
      $last = '';
      }else{
      $plus = '<li class="pages_item"><a class="pages_link" href="'.$sittings[site_url].'?q='.$q.'&amp;page='.($page + 1).'" title="Следующая"><img src="'.$url.'theme/mytheme/img/31.png" alt="&gt;" class="toolbar_button" title="Следующая страница"/></a></li>';
      $last = '<li class="pages_item"><a class="pages_link" href="'.$sittings[site_url].'?q='.$q.'&amp;page='.$total.'" title="Последняя страница"><img src="'.$url.'theme/mytheme/img/37.png" alt="&gt;|" class="toolbar_button" title="Последняя страница"/></a></li>';
      }
      if(($page + 1) > $total) $forw1 = '';
      if(($page + 2) > $total) $forw2 = '';
      if(($page + 3) > $total) $forw3 = '';
      if(($page - 1) <= 0) $back1 = '';
      if(($page - 2) <= 0) $back2 = '';
      if(($page - 3) <= 0) $back3 = '';
      $all_pages = '<div class="pages"><ul class="pages_list">'.$first.$minus.$back3.$back2.$back1.'<li class="pages_list_selected"><span class="pages_list_selected">'.$page.'</span></li>'.$forw1.$forw2.$forw3.$plus.$last.'</ul></div>';
      return $all_pages;
     
    }else return '';}
     
    function remote_filesize($url)     
    { 
      ob_start(); 
      $ch = curl_init($url); 
      curl_setopt($ch, CURLOPT_HEADER, 1); 
      curl_setopt($ch, CURLOPT_NOBODY, 1); 
      $ok = curl_exec($ch); 
      curl_close($ch); 
      $head = ob_get_contents(); 
      ob_end_clean(); 
      $regex = '/Content-Length:\s([0-9].+?)\s/'; 
      $count = preg_match($regex, $head, $matches); 
      return isset($matches[1]) ? $matches[1] : "unknown"; 
    } 
     
    function encode_date($edate)
    {
        global $add_date , $add_time;
        ereg ("([0-9]{2})([0-9]{2})([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})", $edate, $encoded_d); // Дата, День\Месяц\Год\Час\Минуты\Секунды
     
        $encoded_d[2] = str_replace("01","Января", $encoded_d[2]);
        $encoded_d[2] = str_replace("02","Февраля", $encoded_d[2]);
        $encoded_d[2] = str_replace("03","Марта", $encoded_d[2]);
        $encoded_d[2] = str_replace("04","Апреля", $encoded_d[2]);
        $encoded_d[2] = str_replace("05","Мая", $encoded_d[2]);
        $encoded_d[2] = str_replace("06","Июня", $encoded_d[2]);
        $encoded_d[2] = str_replace("07","Июля", $encoded_d[2]);
        $encoded_d[2] = str_replace("08","Августа", $encoded_d[2]);
        $encoded_d[2] = str_replace("09","Сентября", $encoded_d[2]);
        $encoded_d[2] = str_replace("10","Октября", $encoded_d[2]);
        $encoded_d[2] = str_replace("11","Ноября", $encoded_d[2]);
        $encoded_d[2] = str_replace("12","Декабря", $encoded_d[2]);
       
        $add_date=''.$encoded_d[1].' '.$encoded_d[2].' '.$encoded_d[3].'';
        $add_time=''.$encoded_d[4].':'.$encoded_d[5].':'.$encoded_d[6].'';
    }
     
     
    function encodestring($st)
      {
     
        $st=strtr($st,"абвгдеёзийклмнопрстуфхъыэ", "abvgdeeziyklmnoprstufh'ie");
        $st=strtr($st,"АБВГДЕЁЗИЙКЛМНОПРСТУФХЪЫЭ", "ABVGDEEZIYKLMNOPRSTUFH'IE");
        $st=trim($st);
        $st=ereg_replace(" +"," ",$st);
        $st=strtr($st, array(
                            "ж"=>"zh", "ц"=>"ts", "ч"=>"ch", "ш"=>"sh",
                            "щ"=>"shch","ь"=>"", "ю"=>"yu", "я"=>"ya",
                            "Ж"=>"ZH", "Ц"=>"TS", "Ч"=>"CH", "Ш"=>"SH",
                            "Щ"=>"SHCH","Ь"=>"", "Ю"=>"YU", "Я"=>"YA",
                            "Ї"=>"Yi", "є"=>"ie", "Є"=>"Ye", " "=>"-"
                            ));
        $st=preg_replace("/[^A-Za-z-_0-9]/", "", $st);
        return $st;
      }
     
    function smiles($sourse)
    {
        $sourse = str_replace(":)", "<img src=/images/smiles/icon_smile.gif>", $sourse);
        $sourse = str_replace(":biggrin:","<img src=/images/smiles/icon_biggrin.gif>", $sourse);
        $sourse = str_replace(":surprised:","<img src=/images/smiles/icon_surprised.gif>", $sourse);
        $sourse = str_replace(":eek:","<img src=/images/smiles/icon_eek.gif>", $sourse);
        $sourse = str_replace(":conf:","<img src=/images/smiles/icon_confused.gif>", $sourse);
        $sourse = str_replace(":cool:","<img src=/images/smiles/icon_cool.gif>", $sourse);
        $sourse = str_replace(":lol:","<img src=/images/smiles/icon_lol.gif>", $sourse);
        $sourse = str_replace(":mad:","<img src=/images/smiles/icon_mad.gif>", $sourse);
        $sourse = str_replace(":razz:","<img src=/images/smiles/icon_razz.gif>", $sourse);
        $sourse = str_replace(":(","<img src=/images/smiles/icon_sad.gif>", $sourse);
        $sourse = str_replace(":oops:","<img src=/images/smiles/icon_redface.gif>", $sourse);
        $sourse = str_replace(":cry:","<img src=/images/smiles/icon_cry.gif>", $sourse);
        $sourse = str_replace(":evil:","<img src=/images/smiles/icon_evil.gif>", $sourse);
        $sourse = str_replace(":twisted:","<img src=/images/smiles/icon_twisted.gif>", $sourse);
        $sourse = str_replace(":roll:","<img src=/images/smiles/icon_rolleyes.gif>", $sourse);
        $sourse = str_replace(":wink:","<img src=/images/smiles/icon_wink.gif>", $sourse);
        $sourse = str_replace(":ex:","<img src=/images/smiles/icon_exclaim.gif>", $sourse);
        $sourse = str_replace(":quest:","<img src=/images/smiles/icon_question.gif>", $sourse);
        $sourse = str_replace(":idea:","<img src=/images/smiles/icon_idea.gif>", $sourse);
        $sourse = str_replace(":arr:","<img src=/images/smiles/icon_arrow.gif>", $sourse);
        return $sourse;
    }
     
    function bbcode($sourse)
    {
        $sourse=str_replace("\r\n","<br>",$sourse);
        $sourse = preg_replace("#\[b\](.+)\[\/b\]#iU", "<b>\\1</b>", $sourse);
        $sourse = preg_replace("#\[s\](.+)\[\/s\]#iU", "<s>\\1</s>", $sourse);
        $sourse = preg_replace("#\[i\](.+)\[\/i\]#iU", "<i>\\1</i>", $sourse);
        $sourse = preg_replace("#\[u\](.+)\[\/u\]#iU", "<u>\\1</u>", $sourse);
        $sourse = preg_replace("#\[center\](.+)\[\/center\]#iU", "<center>\\1</center>", $sourse);
        $sourse = preg_replace("#\[left\](.+)\[\/left\]#iU", "<div align=\"left\">\\1</div>", $sourse);
        $sourse = preg_replace("#\[right\](.+)\[\/right\]#iU", "<div align=\"right\">\\1</div>", $sourse);
        $sourse = preg_replace("#\[size=([0-9]+)\](.+)\[\/size\]#iU", "<font style=\"font-size:\\1px;\">\\2</font>", $sourse);
        $sourse = preg_replace("#\[color=([a-zA-Z0-9\#]+)\](.*)\[\/color\]#iU", "<span style=\"color:\\1;\">\\2</span>", $sourse);
        $sourse = preg_replace("#\[font=([a-zA-Z0-9 ]+)\](.*)\[\/font\]#iU", "<font style=\"font-family:\"\\1\";\">\\2</font >", $sourse);
        $sourse = preg_replace("#\[img\]([^ \n\r]+)\[\/img\]#iU", "<img src=\"\\1\"  >", $sourse);
        $sourse = preg_replace("#\[img=([a-zA-Z]+)\]([^ \n\r]+)\[\/img\]#iU", "<img src=\"\\2\" align=\"\\1\" >", $sourse);
        $sourse = preg_replace("#\[url=([^ \r\n]+)\](.+)\[\/url\]#iU", "<a href=\"\\1\" target=_blank >\\2</a>", $sourse);
        return $sourse;
    }
     
    function filter($sourse , $id)
    { 
      //global $filter_error;
      if ($id=='0') {}
      if ($id=='1') {$sourse=preg_replace("/[^0-9]/i", "",$sourse);}
      if ($id=='2') {$sourse=preg_replace("/[^A-Za-z-_0-9]/i", "",$sourse);}
      if ($id=='3') {$sourse=preg_replace("/[^A-Za-zА-Яа-я-_0-9(\)\ ]/i", "",$sourse);}
      if ($id=='4') {if (!preg_match("/^([A-Za-z-_0-9 ]+)$/", $sourse)) $sourse='error';}
       
      if ($id=='5') {if (!preg_match("/^[A-Z0-9._%-]+@[A-Z0-9][A-Z0-9.-]{0,61}[A-Z0-9]\.[A-Z]{2,6}$/i", $sourse) or strlen($sourse)>'35' or strlen($sourse)<'5' ) $sourse='error';}
      if ($id=='6') {if (!preg_match("/^([A-Za-z-_0-9 ]+)$/", $sourse) or strlen($sourse)>'35' or strlen($sourse)<'5') $sourse='error';}
      if ($id=='9') {$sourse=ereg_replace(" +"," ",$sourse); $sourse=str_replace(''._MP3_search_4.'',"",$sourse); $sourse=htmlspecialchars(trim($sourse)); }
         
      if ($id=='7') //Проверка текста на валидность!
      {
      if (empty($sourse)){$sourse='!error_empty';}else{
      if (!preg_match("/^([A-Za-z-_0-9 ]+)$/", $sourse)){$sourse='!error_sigils';}else{
      if (strlen($sourse)>'35') {$sourse='!error_max';}else{
      if (strlen($sourse)<'5') {$sourse='!error_min';}else{
      }}}}}
     
      if ($id=='8') //Проверка E-mail адреса на валидность!
      {
      if (empty($sourse)){$sourse='!error_empty';}else{ 
      if (!preg_match("/^[A-Z0-9._%-]+@[A-Z0-9][A-Z0-9.-]{0,61}[A-Z0-9]\.[A-Z]{2,6}$/i", $sourse)){$sourse='!error_sigils';}else{
      if (strlen($sourse)>'35') {$sourse='!error_max';}else{
      if (strlen($sourse)<'5') {$sourse='!error_min';}else{
      }}}}}
     
      return $sourse;
    }
     
    # Добавляем слеши к ковычкам
    function adsl($res)
    {
      if (get_magic_quotes_gpc())
      {
      return($res);
      }
      else
      {
      return(addslashes($res));
      }
    }
    // Mail
    function sendMail($from, $to, $subject, $data)
    {
      $subject = '=?koi8-r?B?'.base64_encode(convert_cyr_string($subject, "w","k")).'?=';
      $headers = "From:$from\n";
      $headers .= "Content-Type: text; charset=windows-1251";
      mail($to, $subject, $data, $headers);
    }
    //Кол-во юзверей на сайте! \\$usercount = getUsersOnline(); echo $usercount;
    function getUsersOnline() {
      $rip = $_SERVER['REMOTE_ADDR'];
      $sd  = time();
      $count = 1;
      $file1 = "include/users_online.txt";
      $lines = file($file1);
      $line2 = "";
      foreach ($lines as $line_num => $line) {
      $fp = strpos($line,'****');
      $nam = substr($line,0,$fp);
      $sp = strpos($line,'++++');
      $val = substr($line,$fp+4,$sp-($fp+4));
      $diff = $sd-$val;
      if($diff < 300 && $nam != $rip) {
      $count = $count+1;
      $line2 = $line2.$line;
      }}
      $my = $rip."****".$sd."++++\n";
      $open1 = fopen($file1, "w");
      fwrite($open1,"$line2");
      fwrite($open1,"$my");
      fclose($open1);
      return $count;       
    }
    //Обновления счетчика скачек для download.php
    function update_dow_cointer() {
      $str=fopen("include/counter.txt" ,"r");
      $str=fread($str,8192);
      $arstr=explode("|",$str);
      $str=$arstr[1]+'1'; //Счетчик кол-ва скачек
      if(strlen($arstr[0]) > '0' and strlen($arstr[1]) > '0'){
      $open=fopen("include/counter.txt","w+");
      fwrite($open, ''.$arstr[0].'|'.$str.'' );
      fclose($open);
      }
    }
    //Замена '\n' на '<br/>'
    function nl2br2($string) {
      $string = str_replace(array('\r\n', '\r', '\n'), '<br />', $string);
      return $string;
    }
    //Выбираем рекламный баннер из include/ads.txt
    function search_ads($string) {
      $file_array = file("include/ads.txt");
      $rand=rand(0,count($file_array)-'1');
      return $file_array[$rand];
    }
    //Для админки , замена 0 на no и 1 на yes
    function yes_no($string) {
      if($string=='0'){$string='No';}
      if($string=='1'){$string='Yes';}
      return $string;
    }
    //Считываем контент gz файла в переменную!
    function gzfile_get_contents($filename, $use_include_path = 0){
      if(!@file_exists($filename)){return false;}
      $data = gzfile($filename, $use_include_path);
      $data = implode($data);
      return $data;
    }
    ?>
     
  2. Цукер

    Цукер Сам себе призедент

    Moderator
    Регистр.:
    5 мар 2008
    Сообщения:
    405
    Симпатии:
    371
    что за движок скажи(или загрузи куда нить) ?
    *как один из банальных вариантов.... может IP сервера в бане ВК
     
  3. stealthdebuger

    stealthdebuger Механик

    Administrator
    Регистр.:
    25 авг 2008
    Сообщения:
    628
    Симпатии:
    1.388
    HatoL, это что, изощренный способ набивать посты? Если нет, то поясни мне каким боком javascript к парсингу музыки?

    Arioh, тот пример, который ты нашел несколько устарел, ВК вносил некоторые изменения в процедуру авторизации, потому у тебя не работает скрипт. Возьми любой сниффер и посмотри как проходит авторизация.
     
Статус темы:
Закрыта.