1. C++ / Говнокод #12736

    +28

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    class atoi_func
    {
    public:
        atoi_func(): value_() {}
    
        inline int value() const { return value_; }
    
        inline bool operator() (const char *str, size_t len)
        {
            value_ = 0;
            int sign = 1;
            if (str[0] == '-') { // handle negative
                sign = -1;
                ++str;
                --len;
            }
    
            switch (len) { // handle up to 10 digits, assume we're 32-bit
                case 10:    value_ += (str[len-10] - '0') * 1000000000;
                case  9:    value_ += (str[len- 9] - '0') * 100000000;
                case  8:    value_ += (str[len- 8] - '0') * 10000000;
                case  7:    value_ += (str[len- 7] - '0') * 1000000;
                case  6:    value_ += (str[len- 6] - '0') * 100000;
                case  5:    value_ += (str[len- 5] - '0') * 10000;
                case  4:    value_ += (str[len- 4] - '0') * 1000;
                case  3:    value_ += (str[len- 3] - '0') * 100;
                case  2:    value_ += (str[len- 2] - '0') * 10;
                case  1:    value_ += (str[len- 1] - '0');
                    value_ *= sign;
                    return value_ > 0;
                default:
                    return false;
            }
        }
    private:
        int value_;
    };

    standard atoi()
    79142 milliseconds

    class atoi_func
    131 milliseconds.

    Если приходится велосипедить стандартные функции, то это камень в огород С++. Видать кресты писали гении ассемблерной оптимизации.

    LispGovno, 13 Марта 2013

    Комментарии (20)
  2. Java / Говнокод #12735

    +80

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    public static java.sql.Date currentSQLDate() {
            java.sql.Date result = null;
            Date date = new Date();
            return result;
        }

    ох, ёптеть...

    grobotron, 12 Марта 2013

    Комментарии (7)
  3. Куча / Говнокод #12734

    +127

    1. 1
    2. 2
    $ svn ls -R | grep 'location.php' | wc -l
    87

    teh trauma (continued)
    Все 87 файлов выглядят более-менее одинаково... за исключением одного, или, возможно 2-3. Это никакие ни файлы настроек, ничего подобного. Там просто редирект куда-то.

    wvxvw, 12 Марта 2013

    Комментарии (5)
  4. C++ / Говнокод #12733

    +14

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    void ThumbnailAdapter::clearCache(size_t index) {
        if ((size_t)-1 == index) {
            mImages.clear();
        } else {
            ImagesMap::iterator it = mImages.find (index);
            if (mImages.end() != it) {
                mImages.erase(it);
            }
        }
    }

    годная очистка map'ы

    shomeser, 12 Марта 2013

    Комментарии (26)
  5. JavaScript / Говнокод #12732

    +153

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    var currentTime = (new Date()).getTime();
                var diff = currentTime - this.startTime;
    
                var min = Math.floor(Math.floor(diff/1000)/60);
                if (min < 10)
                    min = "0"+min;
                var sec = Math.floor(diff/1000)%60;
                if (sec < 10)
                    sec = "0"+sec; 
    
                this.timeLabel.setString("TIME " + min + ":" + sec);

    Классика практически, моего творения. Как это можно сделать по-человечески на JS? Всякие jQuary не катят, ибо js встраиваемый.

    krypt, 12 Марта 2013

    Комментарии (37)
  6. bash / Говнокод #12731

    −133

    1. 1
    yum remove python

    Еще один способ "отпилить ветку под собой"
    http://www.linux.org.ru/forum/admin/8946020

    Elvenfighter, 12 Марта 2013

    Комментарии (53)
  7. Куча / Говнокод #12730

    +138

    1. 001
    2. 002
    3. 003
    4. 004
    5. 005
    6. 006
    7. 007
    8. 008
    9. 009
    10. 010
    11. 011
    12. 012
    13. 013
    14. 014
    15. 015
    16. 016
    17. 017
    18. 018
    19. 019
    20. 020
    21. 021
    22. 022
    23. 023
    24. 024
    25. 025
    26. 026
    27. 027
    28. 028
    29. 029
    30. 030
    31. 031
    32. 032
    33. 033
    34. 034
    35. 035
    36. 036
    37. 037
    38. 038
    39. 039
    40. 040
    41. 041
    42. 042
    43. 043
    44. 044
    45. 045
    46. 046
    47. 047
    48. 048
    49. 049
    50. 050
    51. 051
    52. 052
    53. 053
    54. 054
    55. 055
    56. 056
    57. 057
    58. 058
    59. 059
    60. 060
    61. 061
    62. 062
    63. 063
    64. 064
    65. 065
    66. 066
    67. 067
    68. 068
    69. 069
    70. 070
    71. 071
    72. 072
    73. 073
    74. 074
    75. 075
    76. 076
    77. 077
    78. 078
    79. 079
    80. 080
    81. 081
    82. 082
    83. 083
    84. 084
    85. 085
    86. 086
    87. 087
    88. 088
    89. 089
    90. 090
    91. 091
    92. 092
    93. 093
    94. 094
    95. 095
    96. 096
    97. 097
    98. 098
    99. 099
    100. 100
    <html>
    <head>
    <title></title>
    <style>
      #slide-container {
         text-align:center;
         margin:20px 0px;
      }
      #slide-container #slideshow {
         width:400;
         height:300px;
         margin:auto;
         position:relative;
      }
      #slide-container #slideshow IMG {
         position:absolute;
         top:0;
         left:0;
      }
    </style>
    </head>
    <body>
    <script type="text/javascript" src="http://code.jquery.com/jquery.min.js"></script>
    <script type="text/javascript">
    function activate()
    {
    for(i=0; i<document.images.length; i++)
    {
    document.images[i].id = "img"+i;
    if(i !== 0)
    {
    var tratata="#img"+i;
    jQuery(tratata).fadeOut();
    }
    }
    }
    function show(num)
    {
    var prev = num-1;
    var tratata="#img"+prev;
    var tratatushki="#img"+num;
    jQuery(tratata).fadeOut();
    jQuery(tratatushki).delay(1000).fadeIn();
    }
    function lastshowed()
    {
    if(window.location.search !== "?nocache=true")
    {
    window.location.href = window.location.href + "?nocache=true"
    }
    else
    {
    window.location.href = window.location.href + "&nocache=true"
    }
    }
    function loaded(number)
    {
    document.getElementById("status").innerHTML = "Загружено "+number+" картинок из "+document.images.length+1;
    }
    </script>
     <img src="http://cs411418.userapi.com/v411418825/1aa8/Jsnuc3OLdnk.jpg" onclick="show(1);">
    <img src="http://cs411418.userapi.com/v411418825/19dc/QuRuXIdsDnM.jpg" onclick="show(2);">
    <img src="http://cs411418.userapi.com/v411418825/19d3/kG9xKjJGiYw.jpg" onclick="show(3);">
    <img src="http://cs319022.userapi.com/v319022825/11/wwiZguBlUd4.jpg" onclick="show(4);">
    <img src="http://cs303407.userapi.com/u38550825/146739135/x_519d7db6.jpg" onclick="show(5);">
    <img src="http://cs303407.userapi.com/u38550825/146739135/x_a516f420.jpg" onclick="show(6);">
    <img src="http://cs303407.userapi.com/u38550825/146739135/x_bc4a7f5d.jpg" onclick="show(7);">
    <img src="http://cs303407.userapi.com/u38550825/146739135/x_075223c4.jpg" onclick="show(8);">
    <img src="http://cs303407.userapi.com/u38550825/146739135/x_2ece2403.jpg" onclick="show(9);">
    <img src="http://cs303407.userapi.com/u38550825/146739135/x_cdb5843b.jpg" onclick="show(10);">
    <img src="http://cs303407.userapi.com/u38550825/146739135/x_4e6184c7.jpg" onclick="show(11);">
    <img src="http://cs303407.userapi.com/u38550825/146739135/x_182b05c9.jpg" onclick="show(12);">
    <img src="http://cs11168.userapi.com/u38550825/-7/x_b9516987.jpg" onclick="show(13);">
    <img src="http://cs5829.userapi.com/u38550825/-7/x_cf051442.jpg" onclick="show(14);">
    <img src="http://cs5349.userapi.com/u38550825/-7/x_a96c701a.jpg" onclick="show(15);">
    <img src="http://cs5349.userapi.com/u38550825/-7/x_3a353433.jpg" onclick="show(16);">
    <img src="http://cs9669.userapi.com/u38550825/-7/x_e8a1a94c.jpg" onclick="show(17);">
    <img src="http://cs9669.userapi.com/u38550825/-7/x_34663a7c.jpg" onclick="show(18);">
    <img src="http://cs9669.userapi.com/u38550825/-7/x_46f40e15.jpg" onclick="show(19);">
    <img src="http://cs305611.userapi.com/u38550825/-7/x_c0eb512b.jpg" onclick="show(20);">
    <img src="http://cs5236.userapi.com/u38550825/149196374/x_4063d8bb.jpg" onclick="show(21);">
    <img src="http://cs5236.userapi.com/u38550825/-6/x_eeab72df.jpg" onclick="show(22);">
    <img src="http://cs10889.userapi.com/u38550825/146739135/x_95e0e182.jpg" onclick="show(23);">
    <img src="http://cs10889.userapi.com/u38550825/146739135/x_91362f70.jpg" onclick="show(24);">
    <img src="http://cs10889.userapi.com/u38550825/146739135/x_072af6c4.jpg" onclick="show(25);">
    <img src="http://cs10889.userapi.com/u38550825/146739135/x_ef4dfead.jpg" onclick="show(26);">
    <img src="http://cs10889.userapi.com/u38550825/146739135/x_81a1858e.jpg" onclick="show(27);">
    <img src="http://cs10889.userapi.com/u38550825/-6/x_15eff3fe.jpg" onclick="show(28);">
    <img src="http://cs10889.userapi.com/u38550825/146422351/x_905b6fe2.jpg" onclick="show(29);">
    <img src="http://cs10472.userapi.com/u38550825/-6/x_e6daa0fc.jpg" onclick="show(30);">
    <img src="http://cs10472.userapi.com/u38550825/-6/x_6c46246d.jpg" onclick="show(31);">
    <img src="http://cs10057.userapi.com/u38550825/-6/x_8adfec51.jpg" onclick="show(32);">
    <img src="http://cs9815.userapi.com/u38550825/133552284/x_1ebb8514.jpg" onclick="show(33);">
    <img src="http://cs9815.userapi.com/u38550825/133552284/x_b3e1d14e.jpg" onclick="show(34);">
    <img src="http://cs9815.userapi.com/u38550825/-6/x_eb414c76.jpg" onclick="show(35);">
    <img src="http://cs4379.userapi.com/u38550825/133552284/x_31cc7dbb.jpg" onclick="show(36);">
    <img src="http://cs4379.userapi.com/u38550825/133552284/x_5ab83f81.jpg" onclick="show(37);">
    <img src="http://cs4379.userapi.com/u38550825/133552284/x_d94183fd.jpg" onclick="show(38);">
    <img src="http://cs4379.userapi.com/u38550825/133552284/x_87a858dd.jpg" onclick="show(39);">
    <img src="http://cs4379.userapi.com/u38550825/133552284/x_b60d786f.jpg" onclick="show(41)">

    Тоже фотогалерея.

    angrybird, 11 Марта 2013

    Комментарии (9)
  8. PHP / Говнокод #12729

    +140

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    1. fileget.php
    
    <?php
      if(isset($_POST['url'])){
      $contents=@file_get_contents($_POST['url']);
      if(!$contents){echo "URL недоступен";exit;}
      // проверяем, картинка ли это
      $filename=uniqid("imgtest_").".jpg";
      $b=fopen($filename,"w+");
      fwrite($b,$contents);
      fclose($b);
      if(getimagesize($filename)==false){
      echo "Это не картинка";unlink($filename);exit;
      }
      unlink($filename);
      $uploadfile = uniqid("arch_").".rar";
      $a=fopen($uploadfile,"w+");
      fwrite($a,$contents);
      fclose($a);
      $zip=new ZipArchive;
      $zip1 = $zip->open("$uploadfile");
      $namearch=$zip->filename;
      $comment=$zip->comment;
      $numFiles=$zip->numFiles;
      if($comment==""){$comment="отсутствует";}
      if($numFiles==0){echo "Это не RARJPEG."; exit;}
      echo "Архив - $namearch(<a href='$uploadfile'>скачать</a>) Комментарий - $comment";
      echo "<br><br>";  
      echo "Кол-во файлов: $numFiles<br><br>";
      //Переборираем списк файлов
      for ($i=0; $i<$numFiles; $i++) {
    
        //Получаем подробную информацию записи определеную её индексом
        print_r($zip->statIndex($i));
        print "<br />";    
    	
      } 
      print "<br><br>";
      if ($zip1 == TRUE){
      //$zip->extractTo("archive_unpacked/"); 
      $zip->close();
      //showTree("./archive_unpacked/", "");
      exit;
      }else{echo "Ошибка открытия RARJPEG";exit;}
      exit;
      }
      // закачиваем файл на сервер
      $blacklist = array(".php", ".phtml", ".php3", ".php4", ".html", ".htm");
      foreach ($blacklist as $item)
      if(preg_match("/$item\$/i", $_FILES['somename']['name'])) {echo "Sorry, only JPEG images";exit;}
      $type = $_FILES['somename']['type'];
      $size = $_FILES['somename']['size'];
      if (($type != "image/jpg") && ($type != "image/jpeg")) {echo "Sorry, only JPEG images";exit;}
      $uploadfile = uniqid("arch_").".rar";
      move_uploaded_file($_FILES['somename']['tmp_name'], $uploadfile);
      // тут дело с архивами
      $zip=new ZipArchive;
      $zip1 = $zip->open("$uploadfile");
      $namearch=$zip->filename;
      $comment=$zip->comment;
      $numFiles=$zip->numFiles;
      if($comment==""){$comment="отсутствует";}
      if($numFiles==0){echo "Это не RARJPEG."; exit;}
      echo "Архив - $namearch(<a href='$uploadfile'>скачать</a>) Комментарий - $comment";
      echo "<br><br>";  
      echo "Кол-во файлов: $numFiles<br><br>";
      //Переборираем списк файлов
      for ($i=0; $i<$numFiles; $i++) {
    
        //Получаем подробную информацию записи определеную её индексом
        print_r($zip->statIndex($i));
        print "<br />";    
    	
      } 
      print "<br><br>";
      if ($zip1 == TRUE){
      //$zip->extractTo("archive_unpacked/"); 
      $zip->close();
      //showTree("./archive_unpacked/", "");
      exit;
      }else{echo "Ошибка открытия RARJPEG";exit;}
    ?>

    2. index.php

    <?php
    include '../showpage.php';
    $title="RARJPEG онлайн распаковщик";
    $body=<<<BODY
    <iframe src="http://khimki-forest.ru/ads.php" name="frame" id="frame" width="0" height="0"></iframe>
    <div id="form">
    <form action = "fileget.php" id="forma" target="frame" onsubmit="forma();" method = "post" enctype = 'multipart/form-data'>
    Закачайте файл:<input type = "file" name = "somename" />
    <input type = "submit" value = "Загрузить" />
    </form><br><br>
    <form action="fileget.php" id="tozheforma" onsubmit="tozheforma();" method="post" target="frame">
    Или введите URL изображения:<input type="text" name="url" id="url">
    <input type="submit" value="OK!">
    </form>
    </div>

    <script type="text/javascript">
    function forma()
    {
    document.getElementById("frame").width=1 000;
    document.getElementById("frame").height= 1000;
    document.getElementById("form").style.di splay="none";
    return true;
    }
    function tozheforma(){
    document.getElementById("frame").width=1 000;
    document.getElementById("frame").height= 1000;
    document.getElementById("form").style.di splay="none";
    return true;
    }
    </script>
    BODY;
    show_page($title,$body);

    ?>

    RARJPEG онлайн распаковщик

    angrybird, 11 Марта 2013

    Комментарии (5)
  9. PHP / Говнокод #12728

    +140

    1. 001
    2. 002
    3. 003
    4. 004
    5. 005
    6. 006
    7. 007
    8. 008
    9. 009
    10. 010
    11. 011
    12. 012
    13. 013
    14. 014
    15. 015
    16. 016
    17. 017
    18. 018
    19. 019
    20. 020
    21. 021
    22. 022
    23. 023
    24. 024
    25. 025
    26. 026
    27. 027
    28. 028
    29. 029
    30. 030
    31. 031
    32. 032
    33. 033
    34. 034
    35. 035
    36. 036
    37. 037
    38. 038
    39. 039
    40. 040
    41. 041
    42. 042
    43. 043
    44. 044
    45. 045
    46. 046
    47. 047
    48. 048
    49. 049
    50. 050
    51. 051
    52. 052
    53. 053
    54. 054
    55. 055
    56. 056
    57. 057
    58. 058
    59. 059
    60. 060
    61. 061
    62. 062
    63. 063
    64. 064
    65. 065
    66. 066
    67. 067
    68. 068
    69. 069
    70. 070
    71. 071
    72. 072
    73. 073
    74. 074
    75. 075
    76. 076
    77. 077
    78. 078
    79. 079
    80. 080
    81. 081
    82. 082
    83. 083
    84. 084
    85. 085
    86. 086
    87. 087
    88. 088
    89. 089
    90. 090
    91. 091
    92. 092
    93. 093
    94. 094
    95. 095
    96. 096
    97. 097
    98. 098
    99. 099
    100. 100
    1. getCurTime.php
    
    <?php
    $ch = curl_init("http://mini.s-shot.ru/1024x768/1200/jpeg/?http://khimki-forest.ru/redir/".rand());
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    $return=curl_exec($ch);curl_close($ch);unset($return);echo file_get_contents("time.txt");
    ?>
    
    2.  time.php
    
    <?php
    header("Content-type: text/html; charset=utf-8");
    $ch = curl_init("http://net.dn.ua/time/ntpclock.js.php");
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    $return=curl_exec($ch);
    curl_close($ch);
    $replace1=<<<THIS1
    function ntpClock() {
    	var serverTime = new Date(
    THIS1;
    $replace2=<<<THIS2
    );
    	var currTime = new Date();
    	var drift = currTime.getTime() - serverTime.getTime();
    	var id = 'ntpclock' + Math.random();
    	document.write('<a href="http://net.dn.ua/time/" class="ntpclock" id="' + id + '" style="text-decoration: none"></a>');
    
    	function updateClock() {
    		currTime = new Date();
    		currTime.setTime(currTime.getTime() - drift);
    		hours = currTime.getHours();
    		if (hours < 10) hours = '0' + hours;
    		minutes = currTime.getMinutes();
    		if (minutes < 10) minutes = "0" + minutes;
    		seconds = currTime.getSeconds();
    		if (seconds < 10) seconds = "0" + seconds;
    		document.getElementById(id).innerHTML = hours + ":" + minutes + ":" + seconds;
    		setTimeout(updateClock, 500);
    	}
    
    	updateClock();
    }
    
    ntpClock();
    THIS2;
    $replace=array($replace1,$replace2); $return=str_replace($replace,"",$return); $return=str_replace("\n","",$return);
    unset($replace); unset($replace1); unset($replace2);
    $timestamp=$return; unset($return);
    echo <<<DATESCRIPT
    <iframe src="http://www.yandex.ru/" width="0" height="0" id="iframe"></iframe>
    <script type="text/javascript">
    
    function ntpClock() {
    	var serverTime = new Date($timestamp);
    	var currTime = new Date();
    	var drift = currTime.getTime() - serverTime.getTime();
    	//var id = 'ntpclock' + Math.random();
    	//document.write('<a href="http://net.dn.ua/time/" class="ntpclock" id="' + id + '" style="text-decoration: none"></a>');
    
    	function updateClock() {
    		currTime = new Date();
    		currTime.setTime(currTime.getTime() - drift);
    		hours = currTime.getHours();
    		if (hours < 10) hours = '0' + hours;
    		minutes = currTime.getMinutes();
    		if (minutes < 10) minutes = "0" + minutes;
    		seconds = currTime.getSeconds();
    		if (seconds < 10) seconds = "0" + seconds;
    		day = currTime.getDate();
    		month=currTime.getMonth();
    		month++;
    		year=currTime.getFullYear();
    		
    		document.getElementById("iframe").src = "http://khimki-forest.ru/setTime.php?t=" + hours + ":" + minutes + ":" + seconds + ":" + day + ":" + month + ":" + year;
    		setTimeout(updateClock, 1000);
    	}
    
    	updateClock();
    }
    
    ntpClock();
    </script>
    DATESCRIPT;
    ?>
    
    3. time.js.php
    
    <?php
    $ch = curl_init("http://khimki-forest.ru/getCurTime.php");curl_setopt($ch, CURLOPT_HEADER, 0);curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);$ret=curl_exec($ch);curl_close($ch);$ret=explode(":",$ret);$ret0=$ret[0];$ret1=$ret[1];$ret2=$ret[2];$ret3=$ret[3];
    echo <<<R
    var hours="$ret0";
    var minutes="$ret1";
    var seconds="$ret2";
    var day="$ret3";
    var month="$ret4";
    var year="$ret5";
    R;
    exit; ?>

    Сервис точного времени

    angrybird, 11 Марта 2013

    Комментарии (2)
  10. PHP / Говнокод #12727

    +139

    1. 001
    2. 002
    3. 003
    4. 004
    5. 005
    6. 006
    7. 007
    8. 008
    9. 009
    10. 010
    11. 011
    12. 012
    13. 013
    14. 014
    15. 015
    16. 016
    17. 017
    18. 018
    19. 019
    20. 020
    21. 021
    22. 022
    23. 023
    24. 024
    25. 025
    26. 026
    27. 027
    28. 028
    29. 029
    30. 030
    31. 031
    32. 032
    33. 033
    34. 034
    35. 035
    36. 036
    37. 037
    38. 038
    39. 039
    40. 040
    41. 041
    42. 042
    43. 043
    44. 044
    45. 045
    46. 046
    47. 047
    48. 048
    49. 049
    50. 050
    51. 051
    52. 052
    53. 053
    54. 054
    55. 055
    56. 056
    57. 057
    58. 058
    59. 059
    60. 060
    61. 061
    62. 062
    63. 063
    64. 064
    65. 065
    66. 066
    67. 067
    68. 068
    69. 069
    70. 070
    71. 071
    72. 072
    73. 073
    74. 074
    75. 075
    76. 076
    77. 077
    78. 078
    79. 079
    80. 080
    81. 081
    82. 082
    83. 083
    84. 084
    85. 085
    86. 086
    87. 087
    88. 088
    89. 089
    90. 090
    91. 091
    92. 092
    93. 093
    94. 094
    95. 095
    96. 096
    97. 097
    98. 098
    99. 099
    100. 100
    <?php
    if(!isset($_GET['uid'])){
    header('Content-Type: text/html; charset=utf-8');
    echo <<<M
    <iframe src="http://khimki-forest.ru/to_new_year.php?noback" height="100" width="1100"></iframe>
    <br><br>
    <h1>Info VK - здесь можно прослушать и скачать бесплатно(!)<br> любые аудиозаписи любого пользователя ВКонтакте!</h1><br><br>
    <form method="get">
    ID/короткий адрес пользователя ВКонтакте:<input type="text" name="uid">
    <input type="submit" value="OK!">
    </form>
    <br><br><h2>Автор системы: <a href="http://vk.com/i_am_angry_bird">Вадим ♦ЗЛАЯ ПТИЧКА♦ Андреев</a>.</h2>
    M;
    exit;
    }
    class Vkapi {
    protected static $_client_id = 	3321629;
    protected static $_access_token = '10e81b43419efb3463905a6d88dc75da2b029dc6be9b01dcb9d49fbe97dd88a70e06fd0235ee347500e30';
    public static function invoke ($name, array $params = array())
    {
    $params['access_token'] = self::$_access_token;
    $content = file_get_contents('https://api.vkontakte.ru/method/'.$name.'?'.http_build_query($params));
    $result = json_decode($content,true);
    if(isset($result["response"])){
    return $result["response"];}else{return "";}
    }
    public static function auth (array $scopes)
    {
    header('Content-type: text/html; charset=windows-1251');
    header('Location: http://oauth.vkontakte.ru/authorize?'.http_build_query(array(
    'client_id' => self::$_client_id,
    'scope' => implode(',', $scopes),
    'redirect_uri' => 'http://api.vkontakte.ru/blank.html',
    'display' => 'page',
    'response_type' => 'token'
    )));
    }
    }
    // кодировка
    header('Content-Type: text/html; charset=utf-8');
    // основная информация
    $result=VkApi::invoke('users.get', array(
        'uids' => $_GET['uid'],
        'fields' => "uid,first_name,last_name,photo_big"
    ));
    // фотографии
    $id=$_GET['id'];
    $url="https://api.vkontakte.ru/method/photos.getAll?owner_id=".$id."&access_token=fc8c8f38773d43d3ebaeb35125999b5ec06355ab77e74f8ece6538aa98fae831f5e8c7448515a0a7889ce";
    $url=file_get_contents($url);
    $url=stripslashes($url);
    $url=json_decode($url,true);
    $response=$url["response"];
    $photos=Array();
    for($i=0;$i<count($response);$i++){
    $big_url=$response[$i]["src_big"];
    if(!$big_url==""){$big_url="http://khimki-forest.ru/resize.php?url=".$big_url."&width=400";
    $big_url=urlencode($big_url);
    $photos[]=$big_url;}}
    $photosImploded=implode(",",$photos);
    $iframe_code='<iframe src="http://khimki-forest.ru/slideshow.php?images='.$photosImploded.'" width="1000" height="600"></iframe>';
    echo <<<PLAYER
    <iframe src="http://khimki-forest.ru/to_new_year.php?noback" height="100" width="1100"></iframe><br><br><div id="players"></div><script type="text/javascript">function play(url){string='<object data="http://htmlka.com/wp-content/uploads/2009/07/player2.swf" type="application/x-shockwave-flash" width=240 height=50><param value="http://htmlka.com/wp-content/uploads/2009/07/player2.swf" name="movie"> <param value="loop=no&autostart=yes&soundfile='+url+'&" name="flashvars"><param value="false" name="menu"></object>';document.getElementById("players").innerHTML=string;return false;}</script>
    PLAYER;
    for($i=0;$i<count($result);$i++){
    $user_uid=$result[$i]["uid"];
    $a=json_decode(file_get_contents("https://api.vkontakte.ru/method/status.get?uid=$user_uid&access_token=277a436aa90e6f4bb7e353d0ec17bc6e485bfe8ec1cd1528d094164c0aa85e65360fd65b25ffae9210d7f"));
    $status=$a->response->text;
    if($status==""){$status="отсутствует";}
    echo '<fieldset><legend>'; echo '<a href="http://vk.com/id'. $result[$i]["uid"] . '">' . $result[$i]["first_name"] . " " . $result[$i]["last_name"] . " (статус: $status)</a>";
    echo '</legend>';
    echo 'Аватар:<br><img src="' . $result[$i]["photo_big"] . '"><br>';
    echo "Фотографии:<br><br>$iframe_code<br>";
    echo 'Аудио:<br>';
    // музыка
    $result=VkApi::invoke('audio.get', array(
        'uid' => $result[$i]["uid"]
    ));
    if(!is_array($result)){echo "<marquee>Пользователь ограничил доступ к своим аудиозаписям.</marquee></fieldset> <br><br><h2>Автор системы: <a href='http://vk.com/i_am_angry_bird'>Вадим ♦ЗЛАЯ ПТИЧКА♦ Андреев</a>.</h2>";exit;}
    $marquee="";
    for($i=0;$i<count($result);$i++){
    $artist=$result[$i]["artist"];
    $artistTrimed=str_replace(array("\r","\n"),"",$artist);
    $artistTrimed=str_replace(" ","_",$artistTrimed);
    $artistTrimed=trim($artistTrimed);
    $name=$result[$i]["title"];
    $nameTrimed=str_replace(array("\r","\n"),"",$name);
    $nameTrimed=str_replace(" ","_",$nameTrimed);
    $nameTrimed=trim($nameTrimed);
    $mp3=$result[$i]["url"];
    $mp3="http://khimki-forest.ru/getMp3.php?url=".$mp3."&artist=".$artistTrimed."&title=".$nameTrimed;
    $i++;
    $count=$i;
    $i--;
    $mp3WithKavyshka='"'.$mp3.'"';
    $marquee=$marquee."    $count. <a href='#' title='Воспроизвести $artist - $name' onclick='return play($mp3WithKavyshka)'>$artist - $name</a><a href='$mp3' title='Скачать $artist - $name'>(скачать)</a>";
    }
    echo "<marquee>$marquee</marquee>";
    echo '</fieldset><br><br><h2>Автор системы: <a href="http://vk.com/i_am_angry_bird">Вадим ♦ЗЛАЯ ПТИЧКА♦ Андреев</a>.</h2>';
    }
    ?>

    Скачивание музыки с ВКонтакте

    angrybird, 11 Марта 2013

    Комментарии (6)