1. Лучший говнокод

    В номинации:
    За время:
  2. PHP / Говнокод #5467

    +160

    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
    <?php
    session_start();
    /**
     * @author motakuji
     * @copyright 2009
     */
     if (!$_SESSION['otvet']) {
            $_SESSION['rand']=rand(1,10);
            $_SESSION['otvet']=true;
             }
     if (isset($_POST['vvod']))
     {
     if ($_POST['vvod']>$_SESSION['rand']){
            $msg="Ваше число больше";
     }
     
     elseif ($_POST['vvod']<$_SESSION['rand']){
            $msg="Ваше число меньше";
     }
     else {
            $msg="Ура!!!Вы угадали!";
            $_SESSION['otvet']=false;
     }
    }
    else $msg='Введите число от 1 до 10';
    ?>
    <html>
    <title>Game</title>
    <head>
    <center>
    <h2> <?=$msg."<br>"; ?> </h2>
    <form method="post" action="<?=$_SERVER['SCRIPT_NAME']?>">
     
    <input type="text" name="vvod" />
    <input type="submit" value="Угадать" />
     
    </form>
    </center>
    </body>
    </html>

    qbasic, 01 Февраля 2011

    Комментарии (9)
  3. Си / Говнокод #5460

    +126

    1. 1
    #define sqr(o) ((o)*(o))

    zagzag, 31 Января 2011

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

    +158

    1. 1
    2. 2
    lblSoundBar = new render::gui::BitmapLabel(strings::StaticString(L"Music"), GameFonts::instance().getGUIFont(), math::float2(380.0f, 225.0f), 0xFFFFFFFF, 1.0f, 0.0f);
    lblMusicBar = new render::gui::BitmapLabel(strings::StaticString(L"Sound"), GameFonts::instance().getGUIFont(), math::float2(380.0f, 315.0f), 0xFFFFFFFF, 1.0f, 0.0f);

    Kirinyale, 31 Января 2011

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

    +159

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    <?
    exec('dir "'.str_replace('/','\\',$fname).'"',$r);
    $r = implode("\r\n",$r);
    $r = str_replace("\xFF",' ',$r);
    preg_match('/[\d]{2,2}\.[\d]{2,2}\.[\d]{2,4}[\s]+[\d]{2,2}\:[\d]{2,2}[\s]+([\d\s]+)/im',$r,$m);
    if (!isset($m[1])) return false;
    $size = str_replace(' ','',$m[1]);

    qbasic, 31 Января 2011

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

    +166

    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
    <?
    ...
    <a href="<?php echo $this->_tpl_vars['sBaseBackend']; ?>
    /page/<?php echo $this->_tpl_vars['aMapMenuItem']['list']->id; ?>
    /"><?php if ($this->_tpl_vars['aMapMenuItem']['list']->header != ''): ?><?php echo $this->_tpl_vars['aMapMenuItem']['list']->header; ?>
    <?php else: ?><?php echo $this->_tpl_vars['aMapMenuItem']['list']->uri; ?>
    <?php endif; ?></a> <?php if ($this->_tpl_vars['aMapMenuItem']['list']->type == 'photo'): ?><sub><a href="<?php echo $this->_tpl_vars['sBaseBackend']; ?>
    /albums/index/<?php echo $this->_tpl_vars['aMapMenuItem']['list']->id; ?>
    /">альбомы</a></sub><?php endif; ?>
    			<?php if ($this->_tpl_vars['aMapMenuItem']['list']->id_parent >= 0): ?>
    				<?php if ($this->_tpl_vars['aMapMenuItem']['list']->position > 1): ?>
    ...
    ?>

    1_and_0, 31 Января 2011

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

    +160

    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
    <?php
     
    if ( !defined ( "DATALIFEENGINE" )){
        die ( "Hacking Attemp!" );
    }
     
    $buff = dle_cache( "main", $config['skin'] );
     
    $sql_result = mysql_query ( "SELECT * FROM " . PREFIX . "_post WHERE approve='1' ORDER BY date DESC LIMIT 0, 6" );
     
    $buff = <<<HTML
    <table class="choser">
    HTML;
     
    $rows=mysql_fetch_array($sql_result);
     
    for($i=0;$i<mysql_num_rows($sql_result);$i++){
        $row[$i] = array ( 'title'=>$rows['title'], 'category'=>$rows['category'], 'alt_name'=>$rows['alt_name'], 'full_story'=>$rows['full_story'], 'id'=>$rows['id'] );
        $link[$i] = $config['http_home_url'] . get_url( $row[$i]['category'] ) . "/" . $row[$i]['id'] . "-" . $row[$i]['alt_name'] . ".html";
        $title[$i] = stripslashes ( $row[$i]['title'] );
        preg_match ( "#<img src=[\"\'](.+?)[\"\'](.*)/>#si", $row[$i]['full_story'], $match );
        if ( trim ( $match[1] ) == '' ){
          preg_match ( "#<!--TBegin--><a href=[\"\'](.+?)[\"\'](.*)></a><!--TEnd-->#si", $row[$i]['full_story'], $match );
       }
       $img[$i] = '<a href="'.$link[$i].'"><img src="'.$match[1].'" alt="'.$title[$i].'" /></a>';
        $full_story[$i] = strip_tags ( stripslashes ( $row[$i]['full_story'] ));
        if ( strlen ( $full_story ) > 100 ){
          $full_story = substr ( $full_story, 0, 100 ) . ' ...';
       }
    }
     
    $buff .= <<<HTML
    <tr>
       <td rowspan=5>
         {$img[1]}
         {$row[1]['title']}
         {$full_story[1]}  
       </td>
     
       <td>
         {$row[2]['title']}
         {$full_story[2]}  
       </td>
    </tr>
     
    <tr>
       <td>
         {$row[3]['title']}
         {$full_story[3]}
       </td>
    </tr>
     
    <tr>
       <td>
         {$row[4]['title']}
         {$full_story[4]}
       </td>
    </tr>
     
    <tr>
       <td>
         {$row[5]['title']}
         {$full_story[5]}
       </td>
    </tr>
     
    <tr>
       <td>
         {$row[6]['title']}
         {$full_story[6]}
       </td>
    </tr>
    </table>
    HTML;
     
    create_cache ( "main", $buff, $config['skin']);
     
    echo $buff;
     
    ?>

    qbasic, 29 Января 2011

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

    +162

    1. 1
    2. 2
    3. 3
    4. 4
    <?php
    if ((substr($_SERVER['USER_AGENT'],0,6)=='Yandex') || (substr($_SERVER['USER_AGENT'],0,11)=='YaDirectBot')) $bot='yandex';
    else if ((strpos($_SERVER['USER_AGENT'],'Googlebot')!==false) || (strpos($_SERVER['USER_AGENT'],'Mediapartners-Google')!==false) || (strpos($_SERVER['USER_AGENT'],'Google Search Appliance')!==false)) $bot='google';
    else if (substr($_SERVER['USER_AGENT'],0,12)=='StackRambler') $bot='rambler';

    qbasic, 28 Января 2011

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

    +158

    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
    <?php
    define('ROOT', './');
    include ROOT.'func.php';
    include ROOT.'class.php';
    puthead();
    if(isset($_GET['e'])){
      echo 'Ошибка '.$_GET['e'];
    }
    $incpage='';
    for($i=0;$i<2;$i++){
      if(isset($_GET["i$i"]) && preg_match('/^[a-zA-Z0-9_]+$/', $_GET["i$i"])) $incpage=$_GET["i$i"];
    }
    if($incpage==''){
    if($is_web) include ROOT.'about.tchtml';
    else include ROOT.'index_page.tchtml';
    }
    else include ROOT.$incpage.'.tchtml';
    putfoot();
    ?>
    
    <?php
    define('ROOT', './');
    include ROOT.'func.php';
    puthead('Заголовок');
    ?>
    Пример создания страниц под двиг
    <?
    putfoot();
    ?>

    The CMS. (Да, это такое название.)
    Как ни странно, в состав входит полноценный форум, гостевая книга, модуль новостей и еще куча всякой херни.
    И все это даже работает.
    Но тут меня угораздило заглянуть в сорцы.
    index.php и пример создания страницы.

    7ion, 23 Января 2011

    Комментарии (9)
  10. bash / Говнокод #5290

    −135

    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
    #!/bin/bash
    
    clear;
    handle_terminate() {
        echo "(received signal) $1
    
    Interrupted, cleaning up." >&2
        cleanup
        cleanup_finish
        $0;
        exit 255
    }
    
    trap handle_terminate 9 1 2 3 15 17 19 23 18 20 24
    y=0;
    x=0;
    num=0;
    for((i=0;i<=9;i++)){
    for((j=0;j<=190;j++)){
      tput cup $x $y
      echo "-"
      let "y=j";
    };
      let "x=x+5";
      y=0;
    };
    
    y=0;
    x=0;
    for((i=0;i<=38;i++)){
    for((j=0;j<=46;j++)){
      tput cup $y $x
      echo "|"
      let "y=j";
    };
      let "x=x+10";
      y=0;
    };
    kill -9 $$
    while :
    do
        sleep 1s;
    done
    exit 0

    Сеточка

    AliceGoth, 15 Января 2011

    Комментарии (9)
  11. C++ / Говнокод #5277

    +164

    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
    // Licensed to Green Energy Corp (www.greenenergycorp.com) under one
    // or more contributor license agreements. See the NOTICE file
    // distributed with this work for additional information
    // regarding copyright ownership. Green Enery Corp licenses this file
    // to you under the Apache License, Version 2.0 (the
    // "License"); you may not use this file except in compliance
    // with the License. You may obtain a copy of the License at
    // http://www.apache.org/licenses/LICENSE-2.0
    // Unless required by applicable law or agreed to in writing,
    // software distributed under the License is distributed on an
    // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    // KIND, either express or implied. See the License for the
    // specific language governing permissions and limitations
    // under the License.
    //
    #include "Objects.h"
    
    #define MACRO_STATIC_INSTANCE(group, var) Group##group##Var##var Group##group##Var##var::mInstance;
    
    namespace apl { namespace dnp {
    
    MACRO_STATIC_INSTANCE(1,0)
    MACRO_STATIC_INSTANCE(1,1)
    MACRO_STATIC_INSTANCE(1,2)
    MACRO_STATIC_INSTANCE(2,0)
    MACRO_STATIC_INSTANCE(2,1)
    MACRO_STATIC_INSTANCE(2,2)
    MACRO_STATIC_INSTANCE(2,3)
    
    <... 100500 строк ...>
    
    MACRO_STATIC_INSTANCE(60,1)
    MACRO_STATIC_INSTANCE(60,2)
    MACRO_STATIC_INSTANCE(60,3)
    MACRO_STATIC_INSTANCE(60,4)
    
    MACRO_STATIC_INSTANCE(80,1)
    
    MACRO_STATIC_INSTANCE(110,0)
    MACRO_STATIC_INSTANCE(111,0)
    MACRO_STATIC_INSTANCE(112,0)
    MACRO_STATIC_INSTANCE(113,0)
    
    //////////////////////////////////////////////
    // Binary Input Types
    //////////////////////////////////////////////
    
    void Group1Var2::Write(apl::byte_t* p, const apl::Binary& v) const { DNPToStream::WriteQ(p, Group1Var2::Inst(), v); }
    void Group2Var1::Write(apl::byte_t* p, const apl::Binary& v) const { DNPToStream::WriteQ(p, Group2Var1::Inst(), v); }
    void Group2Var2::Write(apl::byte_t* p, const apl::Binary& v) const { DNPToStream::WriteQT(p, Group2Var2::Inst(), v); }
    void Group2Var3::Write(apl::byte_t* p, const apl::Binary& v) const { DNPToStream::WriteQT(p, Group2Var3::Inst(), v); }
    
    Binary Group1Var2::Read(const apl::byte_t* p) const { return DNPFromStream::ReadBinaryQV(p, Group1Var2::Inst()); }
    Binary Group2Var1::Read(const apl::byte_t* p) const { return DNPFromStream::ReadBinaryQV(p, Group2Var1::Inst()); }
    Binary Group2Var2::Read(const apl::byte_t* p) const { return DNPFromStream::ReadBinaryQV(p, Group2Var2::Inst()); }
    Binary Group2Var3::Read(const apl::byte_t* p) const { return DNPFromStream::ReadBinaryQVT(p, Group2Var3::Inst()); }

    "We provide world-class engineering services to companies leading the smart energy revolution."
    посредством копипасты. малаца.

    xXx_totalwar, 14 Января 2011

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