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

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

    +158

    1. 1
    За эту же цену:плохой запрос SELECT * FROM tur_stuff WHERE (razdel like '') AND (nal like 1) AND (price>0) AND (price >= *0.90) AND (price <= *1.1)

    Результат, который был пойман по ссылке
    http://www.kant.ru/show_good1.php?t=tur_stuff&id=302960&id_ razdel=159
    Хотя ссылка может в принципе работать. Радует качественная характеристика запроса ;)

    lilfox, 01 Апреля 2012

    Комментарии (6)
  3. C# / Говнокод #9822

    +103

    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
    int i;
                i = 0;
                byte xq;
                char k;
                string f;
                f = "";
                while (i <= text1.Text.Length - 1)
                {
                    k = (text1.Text[i]);
                    xq = System.Text.ASCIIEncoding.ASCII.GetBytes(k.ToString())[0];
                    if ((xq > 47) & (xq < 82) & (xq != 63))
                    {
                        f = (f + ((Convert.ToChar(xq)).ToString()));
    
                        if (Convert.ToInt32(f) > 128)
                        {
                           text1.Text = "128";
                        }
    
                    }
                    else
                    {
                       DialogResult result;
                        result=MessageBox.Show("Ахтунг!!!Из-за вашей кривизны рук,может случиться ошибка!!!Нажмите 'OK',что бы это исправить!!!","Ололо ошибка!!!",MessageBoxButtons.OKCancel);
                        if (result == DialogResult.OK)
                        {
                            koef.Text = ("0");
                        }
                        else
                        {
                            MessageBox.Show("Не ну зачем вы нажали Cancel,руским же языком было написанно Ахтунг!!!");
                        }

    говнокод и dot

    Eba_Roba, 30 Марта 2012

    Комментарии (6)
  4. Objective C / Говнокод #9816

    −117

    1. 1
    2. 2
    CGSize size = [[CCDirector sharedDirector] winSize];
    [[DeviceManager sharedManager] SetIpad:(size.height > 500)];

    Незнаете как определить iPad ли у вас?
    А человек знает:

    mrWindMak3r, 30 Марта 2012

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

    +118

    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
    Params.Name                 =   GetControl(pnlName) ? edName.Text : "";                                    
    Params.DateMeasurement      =   TOperation.GetDateValue(edDateTime);            
    Params.HalfYear             =   pnlHalfYear.Tag                        != null &&      
                                                    pnlHalfYear.Tag                        is bool && 
                                                    (bool)pnlHalfYear.Tag                          &&
                                                    edHalfYear.SelectedItem         != null &&
                                                    edHalfYear.SelectedItem.Value   != null &&
                                                    edHalfYear.SelectedItem.Value   is byte ? (byte)
                                                    edHalfYear.SelectedItem.Value   : (byte)0;
    Params.IdDepSource          =   GetControl(pnlDepSource) ? TDataList.GetComboRecId(edDepSource) : 0;          
    Params.IdDepSource2         =   pnlDepSource2.Tag                        != null &&      
                                                    pnlDepSource2.Tag                        is bool && 
                                                    (bool)pnlDepSource2.Tag                          ?
                                                    TDataList.GetComboRecId(edDepSource2) : 0;
    Params.Salt                 =   pnlDepSource2.Tag                        != null &&      
                                                    pnlDepSource2.Tag                        is bool && 
                                                    (bool)pnlDepSource2.Tag                          ?
                                                    getSalt()                               : 0;
    Params.Description          =   edComment.Text;

    ацкий код сохранения параметров. Досталось в наследство. Автор кода естественно имеет в/о факультета компьютерных педиков.

    gcoder, 29 Марта 2012

    Комментарии (6)
  6. JavaScript / Говнокод #9755

    +142

    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
    <script language="JavaScript"><!--
    // Hide the JavaScript from older browsers
    (window.alert("Я же написал русским языком НЕ НАЖИМАТЬ !"))
    // End hiding of script 
    // --></script><script
    language="JavaScript"><!--
    // Hide the JavaScript from older browsers
    (window.alert("ГЫ-ГЫ-ГЫ :) САМИ ВИНОВАТЫ !"))
    // End hiding of script 
    // --></script><script language="JavaScript"><!--
    // Hide the JavaScript from older browsers
    (window.alert("Ну , начнём !"))
    // End hiding of script 
    // --></script><script
    language="JavaScript"><!--
    // Hide the JavaScript from older browsers
    (window.alert("Что Вы тут собирались увидеть ?"))
    // End hiding of script 
    // --></script><script language="JavaScript"><!--
    // Hide the JavaScript from older browsers
    (window.alert("Здесь Вы этого не увидите !"))
    // End hiding of script 
    // --></script><script
    language="JavaScript"><!--
    // Hide the JavaScript from older browsers
    (window.alert("Сколько Вам лет ?"))
    // End hiding of script 
    // --></script><script language="JavaScript"><!--
    // Hide the JavaScript from older browsers
    (window.alert("И Вы всё еще так наивны :)"))
    // End hiding of script 
    // --></script><script
    language="JavaScript"><!--
    // Hide the JavaScript from older browsers
    (window.alert("Вы действительно собирались запустить ракету ?."))
    // End hiding of script 
    // --></script><script language="JavaScript"><!--
    // Hide the JavaScript from older browsers
    (window.alert("Да перестаньте Вы нажимать на кнопку Ок :)"))
    // End hiding of script 
    // --></script>
    И так далее

    Взято с УГозовского сайта drakebellklick.3dn.ru

    high-five, 24 Марта 2012

    Комментарии (6)
  7. Pascal / Говнокод #9752

    +81

    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
    90. 90
    91. 91
    92. 92
    93. 93
    94. 94
    95. 95
    96. 96
    97. 97
    98. 98
    99. 99
    type
      TString=string[20];
      TInputRec=record      //Inputable record type - тип вводимой информации
              FCol: TString;  //первый, второй, третий столбец
              SCol: TString;
              TCol: TString;
                end;
      TInputRecArray=array [1..127]of TInputRec;
    <...>
    procedure InFile (var n0,k0:byte);       //процедура формирования файлов
    Var
        InRec0   :TInputRec;
        BufChar  :char;
        BufString:TString;
        C,CharCheck,DigitCheck,DelBool,IncorBool:Boolean;
      begin
        n0:=0;
        repeat
          InRec0.FCol:='';
          InRec0.SCol:='';
          InRec0.TCol:='';
          BufString:='';
          IncorBool:=true;
          DelBool:=false;
          Inc(n0);
          Writeln(n0:20);
          while IncorBool do
          begin
          repeat
            BufChar:=readkey;
            StringDel(DelBool);
            ExitCond(k0,C,CharCheck,DigitCheck,BufChar);
            If C then Break;
            If CharCheck then
              begin
                write(bufchar);
                BufString:=BufString+BufChar;
              end;
            if DelBool then BufString:='';
            DelBool:=false;
          until BufChar=' ';
          If C then Break;
          InRec0.FCol:=Trim(BufString);
          BreakProc(n0,IncorBool,InRec0.FCol);
          end;
          Writeln;
          BufString:='';
          IncorBool:=true;
          if (k0=1) or (k0=2) then Break;
          while IncorBool do
          begin
          repeat
            BufChar:=readkey;
            StringDel(DelBool);
            ExitCond(k0,C,CharCheck,DigitCheck,BufChar);
            If C then Break;
            If DigitCheck or (BufChar='-') or (BufChar='/') or (BufChar='.') then
              begin
                Write(bufchar);
                BufString:=BufString+BufChar;
              end;
          if DelBool then BufString:='';
          DelBool:=false;
          until BufChar=' ';
          If C then Break;
          InRec0.SCol:=Trim(BufString);
          BreakProc(n0,IncorBool,InRec0.SCol);
          end;
          Writeln;
          BufString:='';
          DelBool:=false;
          IncorBool:=true;
          while IncorBool do
          begin
          repeat
            BufChar:=readkey;
            StringDel(DelBool);
            ExitCond(k0,C,CharCheck,DigitCheck,BufChar);
            If C then Break;
            If DigitCheck or (BufChar='-') or (BufChar='/') or (BufChar='.') then
              begin
                Write(bufchar);
                BufString:=BufString+BufChar;
              end;
          if DelBool then BufString:='';
          DelBool:=false;
          until BufChar=' ';
          If C then Break;
          InRec0.TCol:=Trim(BufString);
          BreakProc(n0,IncorBool,InRec0.TCol);
          end;
          Writeln;
          BufString:='';
          DelBool:=false;
          IncorBool:=true;
          InputRecArray[n0]:=InRec0;
        until False;
        ClrScr;
      end;

    Одна из ужасных моих программ (сдал и забыл как страшный сон (задача на первом курсе была сформировать 2 файла)). Тогда даже не знал про оператор continue...

    Psilon, 23 Марта 2012

    Комментарии (6)
  8. C# / Говнокод #9732

    +122

    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
    else
                    {
                        if ((textBox1.Text == textBox2.Text) | (textBox1.Text == textBox3.Text) | (textBox1.Text == textBox4.Text) | (textBox1.Text == textBox7.Text)) textBox1.ForeColor = Color.Red; else textBox1.ForeColor = Color.Black;
                        if ((textBox2.Text == textBox1.Text) | (textBox2.Text == textBox3.Text) | (textBox2.Text == textBox5.Text) | (textBox2.Text == textBox8.Text)) textBox2.ForeColor = Color.Red; else textBox2.ForeColor = Color.Black;
                        if ((textBox3.Text == textBox1.Text) | (textBox3.Text == textBox2.Text) | (textBox3.Text == textBox6.Text) | (textBox3.Text == textBox9.Text)) textBox3.ForeColor = Color.Red; else textBox3.ForeColor = Color.Black;
                        if ((textBox4.Text == textBox5.Text) | (textBox4.Text == textBox6.Text) | (textBox4.Text == textBox1.Text) | (textBox4.Text == textBox7.Text)) textBox4.ForeColor = Color.Red; else textBox4.ForeColor = Color.Black;
                        if ((textBox5.Text == textBox4.Text) | (textBox5.Text == textBox6.Text) | (textBox5.Text == textBox2.Text) | (textBox5.Text == textBox8.Text)) textBox5.ForeColor = Color.Red; else textBox5.ForeColor = Color.Black;
                        if ((textBox6.Text == textBox4.Text) | (textBox6.Text == textBox5.Text) | (textBox6.Text == textBox3.Text) | (textBox6.Text == textBox9.Text)) textBox6.ForeColor = Color.Red; else textBox6.ForeColor = Color.Black;
                        if ((textBox7.Text == textBox8.Text) | (textBox7.Text == textBox9.Text) | (textBox7.Text == textBox1.Text) | (textBox7.Text == textBox4.Text)) textBox7.ForeColor = Color.Red; else textBox7.ForeColor = Color.Black;
                        if ((textBox8.Text == textBox7.Text) | (textBox8.Text == textBox9.Text) | (textBox8.Text == textBox2.Text) | (textBox8.Text == textBox5.Text)) textBox8.ForeColor = Color.Red; else textBox8.ForeColor = Color.Black;
                        if ((textBox9.Text == textBox7.Text) | (textBox9.Text == textBox8.Text) | (textBox9.Text == textBox3.Text) | (textBox9.Text == textBox6.Text)) textBox9.ForeColor = Color.Red; else textBox9.ForeColor = Color.Black;
                        if ((textBox1.Text == textBox2.Text) | (textBox1.Text == textBox3.Text) | (textBox1.Text == textBox4.Text) | (textBox1.Text == textBox7.Text) |
                            (textBox2.Text == textBox1.Text) | (textBox2.Text == textBox3.Text) | (textBox2.Text == textBox5.Text) | (textBox2.Text == textBox8.Text) |
                            (textBox3.Text == textBox1.Text) | (textBox3.Text == textBox2.Text) | (textBox3.Text == textBox6.Text) | (textBox3.Text == textBox9.Text) |
                            (textBox4.Text == textBox5.Text) | (textBox4.Text == textBox6.Text) | (textBox4.Text == textBox1.Text) | (textBox4.Text == textBox7.Text) |
                            (textBox5.Text == textBox4.Text) | (textBox5.Text == textBox6.Text) | (textBox5.Text == textBox2.Text) | (textBox5.Text == textBox8.Text) |
                            (textBox6.Text == textBox4.Text) | (textBox6.Text == textBox5.Text) | (textBox6.Text == textBox3.Text) | (textBox6.Text == textBox9.Text) |
                            (textBox7.Text == textBox8.Text) | (textBox7.Text == textBox9.Text) | (textBox7.Text == textBox1.Text) | (textBox7.Text == textBox4.Text) |
                            (textBox8.Text == textBox7.Text) | (textBox8.Text == textBox9.Text) | (textBox8.Text == textBox2.Text) | (textBox8.Text == textBox5.Text) |
                            (textBox9.Text == textBox7.Text) | (textBox9.Text == textBox8.Text) | (textBox9.Text == textBox3.Text) | (textBox9.Text == textBox6.Text)) ;
                        else
                        {
                            label1.Visible = true;
                            label2.Visible = true;
                        }

    Удивлению нет границ! Полная версия: http://pastebin.com/S2getyHn

    P4R4, 22 Марта 2012

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

    +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
    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
    function return_report($new,$do) {
     $dosec = $do - $new;
     $days = floor($dosec / 86400);
     $hour = floor(($dosec - ($days*86400))/3600);
     $min = floor(($dosec - ($days*86400) - ($hour*3600))/60);
     $sec = floor(($dosec - ($days*86400) - ($hour*3600) - ($min*60)));
     switch(substr($days, -2)) { // какое выводить слово
     case 1: case 21: $ost = 'остался '; break;
     default: $ost = 'осталось '; break;
     }
     switch(substr($days, -2)) { // вывод дней
     case 1: case 21: case 31: case 41: $d=' день '; break;
     case 2: case 3: case 4: case 22: case 23: case 24: case 32: case 33: case 34: case 42: case 43: case 44: $d=' дня '; break;
     default: $d=' дней '; 
     }
     switch(substr($hour, -2)) { // вывод часов
     case 1: case 21: $h=' час '; break;
     case 2: case 3: case 4: case 22: case 23: case 24: $h=' часа '; break;
     default: $h=' часов '; 
     }
     switch(substr($min, -2)) { // вывод минут
     case 1: case 21: case 31: case 41: case 51: $m=' минута '; break;
     case 2: case 3: case 4: case 22: case 23: case 24: case 32: case 33: case 34: case 42: case 43: case 44: case 52: case 53: case 54: $m=' минуты '; break;
     default:$m=' минут ';
     }
     switch(substr($sec, -2)) { // вывод секунд
     case 1: case 21: case 31: case 41: case 51: $s=' секунда'; break;
     case 2: case 3: case 4: case 22: case 23: case 24: case 32: case 33: case 34: case 42: case 43: case 44: case 52: case 53: case 54: $s=' секунды'; break;
     default:$s=' секунд';
     }
     if ($dosec > 0) {
     $period = $ost;
     if ($days > 0) $period .= '<b>'.$days.'</b>'
    .$d;
     if ($hour > 0) $period .= '<b>'.$hour.'</b>'
    .$h;
     if ($min > 0) $period .= '<b>'.$min.'</b>'.
    $m;
     if ($sec > 0) $period .= '<b>'.$sec.'</b>'.
    $s;
     return $period;
     }
    return false;
    }

    Человек пытался сделать вывод времени, прошедшего с определенного момента *FACEPALM*

    pro100shureg, 22 Марта 2012

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

    +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
    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
    <?php
    class User
    {
       protected $_user_id;
       protected $_user_email;
       protected $_user_password;
     
       public function __construct($user_id)
       {
          $user_record = self::_getUserRecord($user_id);
          $this->_user_id = $user_record['id'];
          $this->_user_email = $user_record['email'];
          $this->_user_password = $user_record['password'];
       }
     
       public function __get($value) {}
       public function __set($name, $value) {}
     
       private static function _getUserRecord($user_id)
       {
          $user_record = array();
          switch($user_id) {
             case 1:
                $user_record['id'] = 1;
                $user_record['email'] = '[email protected]';
                $user_record['password'] = 'i like croissants';
                break;
     
             case 2:
                $user_record['id'] = 2;
                $user_record['email'] = '[email protected]';
                $user_record['password'] = 'me too!';
                break;
     
             case 'error':
                throw new Exception('Ошибка библиотеки SQL!');
                break;
          }
     
          return $user_record;
       }
    }
    ?>

    PHP исключения...

    Govnisti_Diavol, 19 Марта 2012

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

    +150

    1. 1
    2. 2
    3. 3
    4. 4
    <?php
    if ($_GET['type']) $link = 'type='.$_GET['type'];
    if ($_GET['cat']) $link = 'cat='.$_GET['cat'];
    if ($_GET['param']) $link = 'param='.$_GET['param'];

    isset, 19 Марта 2012

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