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

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

    +159

    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
    $t2 = db_query("SELECT
          			COUNT(*)
      			FROM
         			order_delivery_offers AS odf,
         			uc_orders AS uo
      			WHERE
         			odf.order_id = uo.order_id AND
         			uo.uid = $uid AND
         			uo.order_status = 'accepted' AND
         			odf.status = 'accepted' AND
         			odf.visible = 1 AND
         			odf.active = 1
      			GROUP BY odf.order_id");
      $count_rows2 = 0;
      while ($r2 = db_fetch_array($t2)){
    		$count_rows2++;
      }

    Подсчет количества записей в запросе.

    beertudam, 04 Декабря 2011

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

    +168

    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
    case IDC_LED1_ZERO:
    				if (::IsDlgButtonChecked (hWnd,IDC_LED1_ZERO) )
    				{
    					if (::IsDlgButtonChecked (hWnd,IDC_LED2_ANYSPEED) || 
    						::IsDlgButtonChecked (hWnd,IDC_LED3_ANYSPEED) || 
    						::IsDlgButtonChecked (hWnd,IDC_LED4_ANYSPEED) )
    						::CheckDlgButton(hWnd,IDC_LED1_ANYSPEED,0);
    
    					if (::IsDlgButtonChecked (hWnd,IDC_LED2_POSITION) || 
    						::IsDlgButtonChecked (hWnd,IDC_LED3_POSITION) || 
    						::IsDlgButtonChecked (hWnd,IDC_LED4_POSITION) )
    						::CheckDlgButton(hWnd,IDC_LED1_POSITION,0);
    
    					if (::IsDlgButtonChecked (hWnd,IDC_LED2_DIGITAL_INPUT) || 
    						::IsDlgButtonChecked (hWnd,IDC_LED3_DIGITAL_INPUT) || 
    						::IsDlgButtonChecked (hWnd,IDC_LED4_DIGITAL_INPUT) )
    						::CheckDlgButton(hWnd,IDC_LED1_DIGITAL_INPUT,0);
    
    					::CheckDlgButton(hWnd,IDC_LED1_TURN_UNDER,0);
    					::CheckDlgButton(hWnd,IDC_LED2_ZERO,0);
    					::CheckDlgButton(hWnd,IDC_LED3_ZERO,0);
    					::CheckDlgButton(hWnd,IDC_LED4_ZERO,0);
    
    				}
    		break;
    		case IDC_LED1_ANYSPEED:
    				if (::IsDlgButtonChecked (hWnd,IDC_LED1_ANYSPEED) )
    				{
    					
    					if (::IsDlgButtonChecked (hWnd,IDC_LED2_ZERO) || 
    						::IsDlgButtonChecked (hWnd,IDC_LED3_ZERO) || 
    						::IsDlgButtonChecked (hWnd,IDC_LED4_ZERO) )
    						::CheckDlgButton(hWnd,IDC_LED1_ZERO,0);
    
    					if (::IsDlgButtonChecked (hWnd,IDC_LED2_POSITION) || 
    						::IsDlgButtonChecked (hWnd,IDC_LED3_POSITION) || 
    						::IsDlgButtonChecked (hWnd,IDC_LED4_POSITION) )
    						::CheckDlgButton(hWnd,IDC_LED1_POSITION,0);
    					
    					if (::IsDlgButtonChecked (hWnd,IDC_LED2_DIGITAL_INPUT) || 
    						::IsDlgButtonChecked (hWnd,IDC_LED3_DIGITAL_INPUT) || 
    						::IsDlgButtonChecked (hWnd,IDC_LED4_DIGITAL_INPUT) )
    						::CheckDlgButton(hWnd,IDC_LED1_DIGITAL_INPUT,0);
    
    					::CheckDlgButton(hWnd,IDC_LED1_TURN_UNDER,0);
    					::CheckDlgButton(hWnd,IDC_LED2_ANYSPEED,0);
    					::CheckDlgButton(hWnd,IDC_LED3_ANYSPEED,0);
    					::CheckDlgButton(hWnd,IDC_LED4_ANYSPEED,0);
    				}
    		break;
    		case IDC_LED1_POSITION:
    				if (::IsDlgButtonChecked (hWnd,IDC_LED1_POSITION) )
    				{
    					
    					if (::IsDlgButtonChecked (hWnd,IDC_LED2_ZERO) || 
    						::IsDlgButtonChecked (hWnd,IDC_LED3_ZERO) || 
    						::IsDlgButtonChecked (hWnd,IDC_LED4_ZERO) )
    						::CheckDlgButton(hWnd,IDC_LED1_ZERO,0);
    
    					if (::IsDlgButtonChecked (hWnd,IDC_LED2_ANYSPEED) || 
    						::IsDlgButtonChecked (hWnd,IDC_LED3_ANYSPEED) || 
    						::IsDlgButtonChecked (hWnd,IDC_LED4_ANYSPEED) )
    						::CheckDlgButton(hWnd,IDC_LED1_ANYSPEED,0);
    					
    					if (::IsDlgButtonChecked (hWnd,IDC_LED2_DIGITAL_INPUT) || 
    						::IsDlgButtonChecked (hWnd,IDC_LED3_DIGITAL_INPUT) || 
    						::IsDlgButtonChecked (hWnd,IDC_LED4_DIGITAL_INPUT) )
    						::CheckDlgButton(hWnd,IDC_LED1_DIGITAL_INPUT,0);
    
    					::CheckDlgButton(hWnd,IDC_LED1_TURN_UNDER,0);
    					::CheckDlgButton(hWnd,IDC_LED2_POSITION,0);
    					::CheckDlgButton(hWnd,IDC_LED3_POSITION,0);
    					::CheckDlgButton(hWnd,IDC_LED4_POSITION,0);
    
    				}
    		break;
    		case IDC_LED1_TURN_UNDER:
    				if (::IsDlgButtonChecked (hWnd,IDC_LED1_TURN_UNDER) )
    				{
    					
    					if (::IsDlgButtonChecked (hWnd,IDC_LED2_ZERO) || 
    						::IsDlgButtonChecked (hWnd,IDC_LED3_ZERO) || 
    						::IsDlgButtonChecked (hWnd,IDC_LED4_ZERO) )
    						::CheckDlgButton(hWnd,IDC_LED1_ZERO,0);
    
    					if (::IsDlgButtonChecked (hWnd,IDC_LED2_ANYSPEED) || 
    						::IsDlgButtonChecked (hWnd,IDC_LED3_ANYSPEED) || 
    						::IsDlgButtonChecked (hWnd,IDC_LED4_ANYSPEED) )
    						::CheckDlgButton(hWnd,IDC_LED1_ANYSPEED,0);
    					
    					if (::IsDlgButtonChecked (hWnd,IDC_LED2_DIGITAL_INPUT) || 
    						::IsDlgButtonChecked (hWnd,IDC_LED3_DIGITAL_INPUT) || 
    						::IsDlgButtonChecked (hWnd,IDC_LED4_DIGITAL_INPUT) )
    						::CheckDlgButton(hWnd,IDC_LED1_DIGITAL_INPUT,0);
    
    					::CheckDlgButton(hWnd,IDC_LED1_POSITION,0);
    					::CheckDlgButton(hWnd,IDC_LED2_TURN_UNDER,0);
    					::CheckDlgButton(hWnd,IDC_LED3_TURN_UNDER,0);
    					::CheckDlgButton(hWnd,IDC_LED4_TURN_UNDER,0);
    				}

    Понадобилось добавить ещё один чек бокс. Зашёл в обработчик - а там такое. И это только начало, всё не поместилось. Чтобы представить масштабы скажу, что чекбоксов 16..., я должен добавить ещё 4.

    slavap, 04 Декабря 2011

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

    +147

    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
    function rating() {
    
     @session_start();
     session_register ("set_ms");
     if (isset($_SESSION['set_ms'])) {
      return false; // старый посетитель
     } else {
      @session_start();
      session_register ("set_ms");
      $_SESSION['set_ms'] = rand(10000, 99999);
      return true; // новый посетитель
     };
    
    
    }

    Daemonium, 29 Ноября 2011

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

    −117

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    private function dateLabel(item:Object, column:AdvancedDataGridColumn):String
    {
    	var df:DateFormatter = new DateFormatter();
    	df.formatString = "DD.MM.YYYY JJ:SS"
    	return df.format(item[column.dataField]);
    }

    перепутал минуты с секундами, тестер долго понять не мог, на сколько часы на сервере спешат )

    remlend, 25 Ноября 2011

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

    +82

    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
    private static void createFile(File f) {
    	try {
    		f.createNewFile();
    		FileOutputStream fs = new FileOutputStream(f);
    		Long time = new Date().getTime();
    
    		int b = 0;
    
    		b = (int) (time % 256);
    		fs.write(b);
    		time /= 256;
    
    		b = (int) (time % 256);
    		fs.write(b);
    		time /= 256;
    
    		b = (int) (time % 256);
    		fs.write(b);
    		time /= 256;
    
    		b = (int) (time % 256);
    		fs.write(b);
    		time /= 256;
    
    		b = (int) (time % 256);
    		fs.write(b);
    		time /= 256;
    
    		b = (int) (time % 256);
    		fs.write(b);
    		time /= 256;
    
    		b = (int) (time % 256);
    		fs.write(b);
    		time /= 256;
    
    		b = (int) (time % 256);
    		fs.write(b);
    		time /= 256;
    
    		fs.flush();
    		fs.close();
    	} catch (IOException e) {
    		e.printStackTrace();
    	}
    }

    Сохранение даты в файл :)

    mastermind, 23 Ноября 2011

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

    +147

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    } catch (PDOException $e)
                {
                print_r($e->__toString());
                die();
                }

    sectus, 23 Ноября 2011

    Комментарии (4)
  8. JavaScript / Говнокод #8607

    +145

    1. 1
    i=i++;

    AjiTae, 22 Ноября 2011

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

    +168

    1. 1
    http://www.shkodenko.kiev.ua/index.php?lang_id=1&content_id=82

    я охуел

    dos_, 21 Ноября 2011

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

    +144

    1. 1
    app::window::event* event = new app::window::event::keyboard::press(key);

    tymofey, 20 Ноября 2011

    Комментарии (4)
  11. Куча / Говнокод #8580

    +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
    -- html-код --
    <div class="sp_middle_row_right" style="margin-right: 10px;">                
                                <input type="hidden" name="capcha" value="1396309901" />               
                    <img src="http://www.uatrade.net/include/parser/capcha.php?image=1396309901" alt="capcha" title="capcha"/>
                </div> 
    -- html-код --
    
     var capcha = $('input[name=capcha]').attr('value');
            var manual_capcha = $('input[name=manual_capcha]').attr('value');
            $.post('http://www.uatrade.net/include/parser/ajax_capcha.php', {capcha:capcha, manual_capcha:manual_capcha}, function(d){
                if(Number(d) === 1){
                        -- код--
                        $.post('http://www.uatrade.net/include/parser/ajax_position.php', {domain:domain, keywords:keywords, yandex:yandex, google:google, country:country}, function(res){
                             -- код --
                       }
               }else{
                    alert('Введите правильно капчу.');
                    return false;
                }

    Пояснение. Капча генерируется "просто и со вкусом". генерится рандомное число, вырезаются первые 4 цифры и это число умножается на 2,5 потом округляется. Результат выводится на картинку. Остальное, думаю, пояснений не требует.

    Это только некоторые "гениальные" моменты из формы (http://www.uatrade.net/parser_position) для проверки позиций сайтов по ключевикам на сайте одной компании, занимающейся созданием и продвижением сайтов (www.uatrade.net).

    elderdarkelf, 20 Ноября 2011

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