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

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

    +166

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    function Check_email(mail1)
        {
            var found = false;
          for (i=0;i<mail1.length;i++)
          {
            if (mail1.charAt(i) == '@') found = true;
            if (mail1.charAt(i) == '.' && found) return true;
          }
          return false;
        }

    ух щи-

    wiz, 01 Июля 2010

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

    +161

    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
    I'm trying to set the selected value of a pulldown on a form.
    I think there is a problem with this syntax
    
    Code:
    
    for(s = 0; s < document.getElementById('dozen[' + i + ']').length; index++) {
    	if(document.getElementById('dozen[' + i + ']')[s].value == selectedDozen){
    			  document.getElementById('dozen[' + i + ']').selectedIndex = s;
    	}
    }
    
    
    Any help?

    набрел вот на такую херь на вебдевелопер.ком

    padonak, 27 Июня 2010

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

    +152

    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
    private function http_post($url, $post_string) {
            
            // add any additional curl options here
            $options = array(CURLOPT_URL => $url,
                             CURLOPT_POST => true,
                             CURLOPT_POSTFIELDS => $post_string,
                             CURLOPT_USERAGENT => "PubSubHubbub-Publisher-PHP/1.0");
            
            $ch = curl_init();
            curl_setopt_array($ch, $options);
                
            $response = curl_exec($ch);
            $this->last_response = $response;
            $info = curl_getinfo($ch);
        
            curl_close($ch);
            
            // all good
            if ($info['http_code'] == 204) 
                return true;
            
            return false;   
        }

    http_post ):

    wiz, 17 Июня 2010

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

    +154

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    function nameFilter(str){
    
    		var re = /^(oxypit|Штемп|хуй|пиде|пидр|пидо|пида|гыы|Techn|PIZDA)/i
    		if (re.test(str)) return true; else return false;
    
    }

    hromjo, 12 Июня 2010

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

    +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
    /**
     * Constructs a URL encoded query string from an array of key/value pairs
     *
     * @access protected
     * @since 2.0
     * @param array $array query string key/value pairs
     * @return string
     */
    protected function _glue( $array )
    {
        $query_string = '';
        foreach( $array as $key => $val ) :
            $query_string .= $key . '=' . rawurlencode( $val ) . '&';
        endforeach;
        
        return '?' . substr( $query_string, 0, strlen( $query_string )-1 );
    }

    http://code.google.com/p/php-twitter/
    опять велосипеды

    striker, 25 Мая 2010

    Комментарии (24)
  7. C++ / Говнокод #3295

    +153

    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
    switch(num_q)
    			{
    				case 0: if(Terminated)MForm->term[num_q] = true;
    						else MForm->pausa[num_q] = true; break;
    				case 1:	if(Terminated)MForm->term[num_q] = true;
    						else MForm->pausa[num_q]= true ; break;
    				case 2: if(Terminated)MForm->term[num_q] = true;
    						else MForm->pausa[num_q] = true; break;
    				case 3: if(Terminated)MForm->term[num_q] = true;
    						else MForm->pausa[num_q]= true; break;
    				case 4: if(Terminated)MForm->term[num_q] = true;
    						else MForm->pausa[num_q]= true; break;
    				case 5: if(Terminated)MForm->term[num_q] = true;
    						else MForm->pausa[num_q]= true; break;
    				case 6: if(Terminated)MForm->term[num_q] = true;
    						else MForm->pausa[num_q]= true; break;
    				case 7: if(Terminated)MForm->term[num_q] = true;
    						else MForm->pausa[num_q]= true; break;
    				case 8: if(Terminated)MForm->term[num_q] = true;
    						else MForm->pausa[num_q]= true; break;
    				case 9: if(Terminated)MForm->term[num_q] = true;
    						else MForm->pausa[num_q] = true; break;
    				case 10: if(Terminated)MForm->term[num_q] = true;
    						else MForm->pausa[num_q] = true; break;
    				case 11: if(Terminated)MForm->term[num_q] = true;
    						else MForm->pausa[num_q] = true; break;
    				case 12: if(Terminated)MForm->term[num_q] = true;
    						else MForm->pausa[num_q] = true; break;
    				case 13: if(Terminated)MForm->term[num_q] = true;
    						else MForm->pausa[num_q] = true; break;
    				case 14: if(Terminated)MForm->term[num_q] = true;
    						else MForm->pausa[num_q]= true; break;
    				case 15: if(Terminated)MForm->term[num_q] = true;
    						else MForm->pausa[num_q] = true; break;
    			}

    ночью надо спать...

    o_jumi, 23 Мая 2010

    Комментарии (24)
  8. VisualBasic / Говнокод #3177

    −359

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    Private Function Leto(ByVal Dat1 As Date) As Boolean
    Return IIf(Dat1.Month > 3 And Dat1.Month < 9, True, False)
    End Function
    
    Private Function Bas(ByVal Cost1 As Decimal, ByVal Kol1 As Integer)
    Return Cost1 * Kol1
    End Function

    вообще это по линку cfdevа лежало в #3142
    http://www.sql.ru/forum/actualthread.aspx?bid=9&tid=467673&hl=

    но он не запостил самое гавно - то есть этот кусок
    и его походу мало кто заметил

    3.14159265, 07 Мая 2010

    Комментарии (24)
  9. JavaScript / Говнокод #3120

    +171

    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
    function showResults()
    {var i=0;if(document.getElementById('choice12').checked==true)
    {i++;}
    if(document.getElementById('choice23').checked==true)
    {i++;}
    if((document.getElementById('choice31').checked==true)&&(document.getElementById('choice32').checked==false)&&(document.getElementById('choice33').checked==true)&&(document.getElementById('choice34').checked==false))
    {i++;}
    if((document.getElementById('choice41').checked==false)&&(document.getElementById('choice42').checked==true)&&(document.getElementById('choice43').checked==true)&&(document.getElementById('choice44').checked==false))
    {i++;}
    if(document.getElementById('text5').value=='type')
    {i++;}
    if(document.getElementById('choice62').checked==true)
    {i++;}
    if(document.getElementById('text7').value=='alt')
    {i++;}
    if((document.getElementById('choice81').checked==false)&&(document.getElementById('choice82').checked==true)&&(document.getElementById('choice83').checked==false)&&(document.getElementById('choice84').checked==true))
    {i++;}
    if(document.getElementById('text9').value=='target')
    {i++;}
    if((document.getElementById('choice101').checked==true)&&(document.getElementById('choice102').checked==false)&&(document.getElementById('choice103').checked==false)&&(document.getElementById('choice104').checked==true))
    {i++;}
    if(document.getElementById('text11').value=='<input>')
    {i++;}
    if(document.getElementById('choice123').checked==true)
    {i++;}
    if((document.getElementById('choice131').checked==false)&&(document.getElementById('choice132').checked==true)&&(document.getElementById('choice133').checked==false)&&(document.getElementById('choice134').checked==true))
    {i++;}
    if(document.getElementById('text14').value=='action')
    {i++;}
    if((document.getElementById('choice151').checked==false)&&(document.getElementById('choice152').checked==true)&&(document.getElementById('choice153').checked==true)&&(document.getElementById('choice154').checked==true))
    {i++;}
    if((document.getElementById('choice161').checked==false)&&(document.getElementById('choice162').checked==false)&&(document.getElementById('choice163').checked==true)&&(document.getElementById('choice164').checked==true))
    {i++;}
    if(document.getElementById('choice174').checked==true)
    {i++;}
    if(document.getElementById('choice182').checked==true)
    {i++;}
    if(document.getElementById('text19').value=='background')
    {i++;}
    if(document.getElementById('choice201').checked==true)
    {i++;}
    document.getElementById('questions').style.display='none';document.getElementById('results').style.display='block';document.getElementById('results').innerHTML='<h2 style="color: #377">Результаты теста</h2>\n<p>Количество правильных ответов: <strong>'+i+'</strong>.</p>';if(i>=18)
    {document.getElementById('results').innerHTML+='<p style="color: #096">Поздравляем с отличным результатом!</p>\n<p style="color: #f00">Оценка 5</p>';}
    if((i<18)&&(i>=14))
    {document.getElementById('results').innerHTML+='<p style="color: #096">Поздравляем с хорошим результатом!</p>\n<p style="color: #f00">Оценка 4</p>';}
    if((i<14)&&(i>=6))
    {document.getElementById('results').innerHTML+='<p style="color: #096">Результат удовлетворительный!</p>\n<p style="color: #f00">Оценка 3</p>';}
    if(i<=6)
    {document.getElementById('results').innerHTML+='<p style="color: #c00">К сожалению, результат очень плохой!!!</p>\n<p style="color: #f00">Оценка 2</p>';}
    document.getElementById('results').innerHTML+='<p class="buttons"> <input type="button" value="Подсказать ответы" onclick= "showQuestions();getHelp();" /></p>';}

    Тест на знание html. Мало того, что говнокод, так там и ответы ещё неправильные. Источник — http://www.cssblok.ru/test/test1.html

    P.S. копирайт снизу на том сайте ("Школьная веб-студия , 2007") всё оправдывает.

    Infamous, 27 Апреля 2010

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

    +924

    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
    // придерживаюсь оригинала как могу
    // код как был:
    
    static char message_buf[64000];  // must be actually 64K == 64<<10 == 65536
    
    class MessageHandler {
       // [...]
       char *header;         // point into the message_buf
       char *content;
       std::list<char *> tlvs; // pointers to the elements of the message
    };
    
    // я пожаловался - пообещали исправить в новой версии по ходу реализации новой фичи.
    
    // новый "усовершенствованый" код, с "поддержкой" многопоточности.
    
    static char message_buf[100][65000];  // 100 == max threads, buffer size now is much closer to the standard
    
    class MessageHandler {
       // [...]
       int threadId;             // index into the new message_buf[]
       char *header;          // point into the message_buf[threadId]
       char *content;
       std::vector<char *> tlvs; // same, but in std::vector because it is "faster"
    };

    вот так кодируют и совершенствуют код матерые шведские программистки.
    самое обидное что мой коллега почти все это пофиксил в оригинальной версии, но из-за важной фичи отказались мержить с новой версией и выкинули почти все его изменения.

    Dummy00001, 26 Апреля 2010

    Комментарии (24)
  11. VisualBasic / Говнокод #3100

    −92

    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
    public class Chart//работа с ChartSpace
    	{
    		/* String sCategories="значение1"+СимволТабуляции(символ с кодом 9)+"значение2"+...
    		 * String sValues="значение1"+СимволТабуляции(символ с кодом 9)+"значение2"+...
    		 */
    		//В VB6 также вместе со "строками через табулятор" поддерживаются одномерные массивы
    		//var
    		public const String sProcedure001 = "OneWindow.Procedure121";
    		public const String sProcedure002 = "OneWindow.Procedure122";
    		public const String sProcedure003 = "OneWindow.Procedure123";
    		public const String sProcedure004 = "OneWindow.Procedure124";
    		public const String sProcedure005 = "OneWindow.Procedure125";
    		public static Int32 iDataLiteral = Convert.ToInt32(OWC11.ChartSpecialDataSourcesEnum.chDataLiteral);
    		public static Object[,] _oZap001;
    		public static Object[,] _oZap002;
    		public static Object[,] _oZap003;
    		public static Object[,] _oZap004;
    		public static Object[,] _oZap005;
    		//end var
    		//property
    		public static Object[,] oZap001
    		{
    			//var
    			//end var
    			get
    			{
    				Int32 iNum = 0;
    				Exception oErr;
    				if (_oZap001 == null)
    				{
    					iNum = Ow.iZap0(sProcedure001, out _oZap001, out oErr);
    					if (iNum <= 0)
    					{
    						_oZap001 = null;
    					}
    				}
    				return _oZap001;
    			}
    		}
    		public static Object[,] oZap002
    		{
    			//var
    			//end var
    			get
    			{
    				Int32 iNum = 0;
    				Exception oErr;
    				if (_oZap002 == null)
    				{
    					iNum = Ow.iZap0(sProcedure002, out _oZap002, out oErr);
    					if (iNum <= 0)
    					{
    						_oZap002 = null;
    					}
    				}
    				return _oZap002;
    			}
    		}
    		public static Object[,] oZap003
    		{
    			//var
    			//end var
    			get
    			{
    				Int32 iNum = 0;
    				Exception oErr;
    				if (_oZap003 == null)
    				{
    					iNum = Ow.iZap0(sProcedure003, out _oZap003, out oErr);
    					if (iNum <= 0)
    					{
    						_oZap003 = null;
    					}
    				}
    				return _oZap003;
    			}
    		}
    		public static Object[,] oZap004
    		{
    			//var
    			//end var
    			get
    			{
    				Int32 iNum = 0;
    				Exception oErr;
    				if (_oZap004 == null)
    				{
    					iNum = Ow.iZap0(sProcedure004, out _oZap004, out oErr);
    					if (iNum <= 0)
    					{
    						_oZap004 = null;
    					}
    				}
    				return _oZap004;
    			}
    		}
    		public static Object[,] oZap005
    		{
    ...

    Я нашел абсолютное гавно!!!!!!
    Максим Прохоров торжественно спиздил исходники сайта okno.mos.ru и забыл в конторе (хуй он забыл, на самом деле я ему доступ закрыл в один прекрасный момент).
    Теперь буду выкладывать маленькими порциями. представляете, за это гавно отвалили миллионов 10. Чиновники их дружно освоили. А отвалили из нашего кармана. Я лично налоги плачу.

    ursus, 23 Апреля 2010

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