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

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

    +156

    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
    <?php
    $result = mysql_query ("SELECT id,title,description, view, author,date,text FROM recipes WHERE MATCH(text) AGAINST('$search')",$db);
    
    if (!$result)
    {
    echo "<p>Запрос на выборку данных из базы не прошел. Напишите об этом вдминистратору [email protected] .
    <br>
    <br>
    <strong>Код ошибки : </strong></p>";
    
    exit(mysql_error());
    }
    if (mysql_num_rows($result) > 0)
    {
    $myrow = mysql_fetch_array ($result);
    
    do
    {
    printf (" <table align='center' cellpadding='0' cellspacing='0' class='recipes'>
    
    <tr>
    <td class='recipes_title'><p class='recipes_name'><a href='recipes_template.php?=id=%s'>%s</a></p>
    <p class='recipes_adds'>Дата добавления: %s</p>
    <p class='recipes_adds'>Автор: %s</p>
    </td>
    </tr>
    <tr>
    <td>%s</td>
    </tr>
    
    </table><br><br>", $myrow["id"], $myrow["title"], $myrow["date"], $myrow["author"], $myrow["description"]);
    }
    while ($myrow = mysql_fetch_array ($result));
    }
    else
    {
    echo "<p> Информация по запросу не может быть извлечена в таблице нет записей. </p>";
    exit();
    }
    ?>
    
    </td>
    </tr>
    <!--Ниний блок сайта-->
    <? include("blocks/down.php"); ?>
    </table>
    </body>
    </html>

    qbasic, 30 Декабря 2010

    Комментарии (14)
  3. JavaScript / Говнокод #4929

    +163

    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
    function Typets()
    {
    	switch (window.document.forms['osago'].elements['tstype'].value)
    	{
    		case 'car': show_power();  show_klass(); show_nar(); show_driver(); break;
    		case 'taxi': show_power();  show_klass(); show_nar(); show_driver(); break;
    		case 'gruzdo16': hide_power();  show_klass(); show_nar(); show_driver(); break;
    		case 'gruz':  hide_power();  show_klass(); show_nar(); show_driver(); break;
    		case 'pricepgruz': hide_power(); hide_klass(); hide_nar(); hide_driver(); break;
    		case 'busdo20': hide_power();  show_klass(); show_nar(); show_driver(); break;
    		case 'bus': hide_power();  show_klass(); show_nar(); show_driver(); break;
    		case 'bustaxi': show_power();  show_klass(); show_nar(); show_driver(); break;
    		case 'trol': hide_power();  show_klass(); show_nar(); show_driver(); break;
    		case 'tram': hide_power();  show_klass(); show_nar(); show_driver(); break;
    		case 'tractor': hide_power(); show_klass(); show_nar();  show_driver(); break;
    		case 'priceptractor': hide_power();  hide_klass(); hide_nar(); hide_driver(); break;
    		case 'moto': hide_power();  show_klass(); show_nar(); show_driver(); break;
    
    	}
    }
    
    //  От туда же
    
    function show_podrobno() {
        window.document.getElementById('podrobno').style.display = 'block'; 
        window.document.getElementById('podrlink').style.display = 'none';   
    }
    
    function hide_podrobno() {
         window.document.getElementById('podrobno').style.display = 'none';
         window.document.getElementById('podrlink').style.display = 'block';  }

    Скопировано из одного сайта :))

    Zuzzuk, 15 Декабря 2010

    Комментарии (14)
  4. PHP / Говнокод #4925

    +163

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    class C
    {
    ...
    static function ModulesList()
    {
                    global $config;
                    return $config;
    }
    ...
    }

    ООП в действии

    elw00d, 15 Декабря 2010

    Комментарии (14)
  5. Pascal / Говнокод #4907

    +109

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    procedure TForm2.ExitButtonClick(Sender: TObject);
    begin
    Close;
    Form1.Close;
    end;

    Об Application.Terminate даже и не догадываемся...

    PEMOHT, 12 Декабря 2010

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

    +167

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    if( $user_id < 0 )
        die( "I don't know you!" );
    
    if( $action == '' )
        die( "I don't know, what you want!" );
    
    if( $action == 'login' )
        die();

    rat4, 11 Декабря 2010

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

    +163

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    $img_name_clean = $_FILES[$key]['name'];
    $img_name_clean = str_replace (".img","",$img_name_clean);
    $img_name_clean = str_replace (".jpeg","",$img_name_clean);
    $img_name_clean = str_replace (".jpg","",$img_name_clean);
    $img_name_clean = str_replace (".gif","",$img_name_clean);
    $img_name_clean = str_replace (".JPG","",$img_name_clean);
    $img_name_clean = str_replace (".IMG","",$img_name_clean);
    $img_name_clean = str_replace (".GIF","",$img_name_clean);
    $img_name_clean = str_replace (".JPEG","",$img_name_clean);
    if(!file_exists("../foto/".$img_name_clean."/")){mkdir("../foto/".$img_name_clean."/", 0777);  chmod('../foto/'.$img_name_clean, 0777);}

    Uchkuma, 07 Декабря 2010

    Комментарии (14)
  8. Pascal / Говнокод #4852

    +96

    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
    83. 83
    84. 84
    85. 85
    86. 86
    87. 87
    88. 88
    89. 89
    procedure TForm1.Button2Click(Sender: TObject);
    var stSQL: string;
    i: integer;
    begin
    
    try
    SQLConnection1.Params.Values['HostName']:=Server; // имя сервера
    SQLConnection1.Params.Values['DataBase']:=MyBase ;
    SQLConnection1.Params.Values['OS Authentication']:= 'True';
    SQLConnection1.Open;
    except
    MessageDlg('Соединение с БД невозможно', mtError, [mbOK], 0);
    exit;
    end;
    
    SQLQuery1.SQL.Add('IF EXISTS (SELECT * FROM sysobjects WHERE name ='+''''+'MyTable'+''''+') DELETE FROM MyTable;');
    SQLQuery1.ExecSQL;
    SQLQuery1.SQL.Clear;
    SQLQuery1.SQL.Add('IF EXISTS (SELECT * FROM sysobjects WHERE name ='+''''+'MyTable'+''''+') DROP TABLE MyTable;');
    SQLQuery1.ExecSQL;
    SQLQuery1.SQL.Clear;
    SQLQuery1.SQL.Add('CREATE TABLE MyTable (VZPROJ varchar(50), PARTITION varchar(50), '+
    'MAKER varchar(50), STATE varchar(50), DATECRT varchar(50), DATEP varchar(50), '+
    'DATEF varchar(50), DATETOCRD varchar(50), DATECRD varchar(50), DATEPLN varchar(50), '+
    'DATEFIN varchar(50), DATECNCL varchar(50))');
    SQLQuery1.ExecSQL;
    
    cdsList.First;
    for i:=1 to cdsList.RecordCount do
    begin
    stSQL:='INSERT INTO MyTable VALUES(';
    if cdsList.FieldByName('VZPROJ').AsString<>'' then
    stSQL:=stSQL+' '''+cdsList.FieldByName('VZPROJ').AsString+''','
    else
    stSQL:=stSQL+' NULL,';
    if cdsList.FieldByName('PARTITION').AsString<>'' then
    stSQL:=stSQL+' '''+cdsList.FieldByName('PARTITION').AsString+''','
    else
    stSQL:=stSQL+' NULL,';
    if cdsList.FieldByName('MAKER').AsString<>'' then
    stSQL:=stSQL+' '''+cdsList.FieldByName('MAKER').AsString+''','
    else
    stSQL:=stSQL+' NULL,';
    if cdsList.FieldByName('STATE').AsString<>'' then
    stSQL:=stSQL+' '''+cdsList.FieldByName('STATE').AsString+''','
    else
    stSQL:=stSQL+' NULL,';
    if cdsList.FieldByName('DATECRT').AsString<>'' then
    stSQL:=stSQL+' '''+cdsList.FieldByName('DATECRT').AsString+''','
    else
    stSQL:=stSQL+' NULL,';
    if cdsList.FieldByName('DATEP').AsString<>'' then
    stSQL:=stSQL+' '''+cdsList.FieldByName('DATEP').AsString+''','
    else
    stSQL:=stSQL+' NULL,';
    if cdsList.FieldByName('DATEF').AsString<>'' then
    stSQL:=stSQL+' '''+cdsList.FieldByName('DATEF').AsString+''','
    else
    stSQL:=stSQL+' NULL,';
    if cdsList.FieldByName('DATETOCRD').AsString<>'' then
    stSQL:=stSQL+' '''+cdsList.FieldByName('DATETOCRD').AsString+''','
    else
    stSQL:=stSQL+' NULL,';
    if cdsList.FieldByName('DATECRD').AsString<>'' then
    stSQL:=stSQL+' "'+cdsList.FieldByName('DATECRD').AsString+''','
    else
    stSQL:=stSQL+' NULL,';
    if cdsList.FieldByName('DATEPLN').AsString<>'' then
    stSQL:=stSQL+' '''+cdsList.FieldByName('DATEPLN').AsString+''','
    else
    stSQL:=stSQL+' NULL,';
    if cdsList.FieldByName('DATEFIN').AsString<>'' then
    stSQL:=stSQL+' '''+cdsList.FieldByName('DATEFIN').AsString+''','
    else
    stSQL:=stSQL+' NULL,';
    if cdsList.FieldByName('DATECNCL').AsString<>'' then
    stSQL:=stSQL+' '''+cdsList.FieldByName('DATECNCL').AsString+''''
    else
    stSQL:=stSQL+' NULL';
    
    stSQL:=stSQL+');';
    
    SQLQuery1.SQL.Clear;
    SQLQuery1.SQL.Add(stSQL);
    SQLQuery1.ExecSQL;
    cdsList.Next;
    end;
    
    end;

    дельфипаста с гарниром

    bugmenot, 07 Декабря 2010

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

    +20

    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
    if( 
        ('node' == arg(0) ) && 
        is_numeric(arg(1) ) && 
        ($node = node_load(array('nid' => arg(1), 'status' => 1 ) ) ) &&
        ( 
            ('chapter' == $node->type) || 
            ('article' == $node->type) ||
            ('gall' == $node->type)
        ) && 
        isset($node->field_parentchapter) && 
        is_array($node->field_parentchapter) && 
        count($node->field_parentchapter) 
    ){
    /// blah blah
    }

    матан, или как сделать из кучи одинаковых if() один

    brainstorm, 06 Декабря 2010

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

    +160

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    /**
         * Filtering posted data. Converting localized data if needed
         *
         * @param array
         * @return array
         */
        protected function _filterPostData($data)
        {
            $data = $this->_filterDates($data, array('dob'));
            return $data;
        }

    Загадочный dob - кто он? Миф или реальность?

    et, 03 Декабря 2010

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

    +115

    1. 1
    2. 2
    if(!string.IsNullOrEmpty(((AccessLevelObject)cbAccessLevel.SelectedItem).Description))
            txtAccessLevelDescription.Text = ((AccessLevelObject)cbAccessLevel.SelectedItem).Description;

    догадайтесь что здесь лишнее )))

    Maxim546, 03 Декабря 2010

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