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

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

    +61

    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
    foreach($combinations as $combination){
      $buffer = array();
      if(count($combination)){
    	if(is_numeric($combination[0])){
    		$a_cnt = count($words[$combination[0]]);
    		for($a=0;$a<$a_cnt;$a++){
    			if(is_numeric($combination[1])){
    			$b_cnt = count($words[$combination[1]]);
    			for($b=0;$b<$b_cnt;$b++){
    				if(is_numeric($combination[2])){
    				$c_cnt = count($words[$combination[2]]);
    				for($c=0;$c<$c_cnt;$c++){
    					if(is_numeric($combination[3])){
    					$d_cnt = count($words[$combination[3]]);
    					for($d=0;$d<$d_cnt;$d++){
    						if(is_numeric($combination[4])){
    						$e_cnt = count($words[$combination[4]]);
    						for($e=0;$e<$e_cnt;$e++){
    							if(is_numeric($combination[5])){
    							$f_cnt = count($words[$combination[5]]);
    							for($f=0;$f<$f_cnt;$f++){
    								if(is_numeric($combination[6])){
    								$g_cnt = count($words[$combination[6]]);
    								for($g=0;$g<$g_cnt;$g++){
    									if(is_numeric($combination[7])){
    									$h_cnt = count($words[$combination[7]]);
    									for($h=0;$h<$h_cnt;$h++){
    										if(is_numeric($combination[8])){
    										$i_cnt = count($words[$combination[8]]);
    										for($i=0;$i<$i_cnt;$i++){
    											if(is_numeric($combination[9])){
    											$j_cnt = count($words[$combination[9]]);
    											for($j=0;$j<$j_cnt;$j++){
    												$buffer[] = $words[$combination[0]][$a]
    														.' '.$words[$combination[1]][$b]
    														.' '.$words[$combination[2]][$c]
    														.' '.$words[$combination[3]][$d]
    														.' '.$words[$combination[4]][$e]
    														.' '.$words[$combination[5]][$f]
    														.' '.$words[$combination[6]][$g]
    														.' '.$words[$combination[7]][$h]
    														.' '.$words[$combination[8]][$i]
    														.' '.$words[$combination[9]][$j];
    											}}
    											else{
    												$buffer[] = $words[$combination[0]][$a]
    														.' '.$words[$combination[1]][$b]
    														.' '.$words[$combination[2]][$c]
    														.' '.$words[$combination[3]][$d]
    														.' '.$words[$combination[4]][$e]
    														.' '.$words[$combination[5]][$f]
    														.' '.$words[$combination[6]][$g]
    														.' '.$words[$combination[7]][$h]
    														.' '.$words[$combination[8]][$i];
    											}
    										}}
    										else{
    											$buffer[] = $words[$combination[0]][$a]
    													.' '.$words[$combination[1]][$b]
    													.' '.$words[$combination[2]][$c]
    													.' '.$words[$combination[3]][$d]
    													.' '.$words[$combination[4]][$e]
    													.' '.$words[$combination[5]][$f]
    													.' '.$words[$combination[6]][$g]
    													.' '.$words[$combination[7]][$h];
    										}
    									}}
    									else{
    										$buffer[] = $words[$combination[0]][$a]
    												.' '.$words[$combination[1]][$b]
    												.' '.$words[$combination[2]][$c]
    												.' '.$words[$combination[3]][$d]
    												.' '.$words[$combination[4]][$e]
    												.' '.$words[$combination[5]][$f]
    												.' '.$words[$combination[6]][$g];
    									}
    								}}
    								else{
    									$buffer[] = $words[$combination[0]][$a]
    											.' '.$words[$combination[1]][$b]
    											.' '.$words[$combination[2]][$c]
    											.' '.$words[$combination[3]][$d]
    											.' '.$words[$combination[4]][$e]
    											.' '.$words[$combination[5]][$f];
    								}
    							}}
    							else{
    								$buffer[] = $words[$combination[0]][$a]
    										.' '.$words[$combination[1]][$b]
    										.' '.$words[$combination[2]][$c]
    										.' '.$words[$combination[3]][$d]
    										.' '.$words[$combination[4]][$e];
    							}
    						}}
    						else{
    							$buffer[] = $words[$combination[0]][$a]
    									.' '.$words[$combination[1]][$b]
    									.' '.$words[$combination[2]][$c]
    									.' '.$words[$combination[3]][$d];
    						}

    Вот такой вот кусок кода, к стати весь не поместился, я нашел в самописном движке, на котором моему знакомому сделали корпоративный сайт на 30 страниц. Бюджет был больше 2к зелени.

    vagrand, 17 Мая 2012

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

    +69

    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
    if (!class_exists('Memcache')) {
    
            class Memcache {
    
                function connect($l, $p) {
                    echo "НЕТ МЕМКЕША";
                    return true;
                }
    
                function get($n) {
                    return false;
                }
    
                function set($a, $b, $v, $g) {
                    return true;
                }
    
            }
    
        }

    улыбнуло )

    Sulik78, 17 Мая 2012

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

    −19

    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
    TElement* get(void)
    {
    	TElement* result = this->allocateBuffer();
    	if (result!=NULL)
    	{
    		try
    		{
    			::new(result) TElement; //Вызов конструктора.
    		}catch(...)//Получили исключение в конструкторе конструироваемого объекта.
    		{
    			this->deallocateBuffer(result);
    			throw;
    		};
    	};
    	return result;
    };
    
    template<class TArg1>
    TElement* get(TArg1 arg1)
    {
    	TElement* result = this->allocateBuffer();
    	if (result!=NULL)
    	{
    		try
    		{
    			::new(result) TElement(arg1); //Вызов конструктора.
    		}catch(...)//Получили исключение в конструкторе конструироваемого объекта.
    		{
    			this->deallocateBuffer(result);
    			throw;
    		};
    	};
    	return result;
    };
    
    //...
    
    template<class TArg1, class TArg2, class TArg3, class TArg4, class TArg5, class TArg6>
    TElement* get(TArg1 arg1, TArg2 arg2, TArg3 arg3, TArg4 arg4, TArg5 arg5, TArg6 arg6)
    {
    	TElement* result = this->AllocateBuffer();
    	if (result!=NULL)
    	{
    		try
    		{
    			::new(result) TElement(arg1, arg2, arg3, arg4, arg5, arg6); //Вызов конструктора.
    		}catch(...)//Получили исключение в конструкторе конструироваемого объекта.
    		{
    			this->DeallocateBuffer(result);
    			throw;
    		};
    	};
    	return result;
    };

    Хотя этот баян мы уже видели на Action Script.

    Говногость, 16 Мая 2012

    Комментарии (3)
  5. Perl / Говнокод #10272

    −119

    1. 1
    my $end_date = ($request =~ /<end_date>(\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d)<\/end_date>/io) ? $1 : '';

    PSIAlt, 15 Мая 2012

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

    +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
    <?php
     
    function md5_decrypt($enc_text, $password='code', $iv_len = 16){
    	$enc_text = base64_decode($enc_text);
    	 $n = strlen($enc_text);
    	 $i = $iv_len;
    	 $plain_text = '';
    	 $iv = substr($password ^ substr($enc_text, 0, $iv_len), 0, 512);
    	  while ($i < $n) {
    	  	$block = substr($enc_text, $i, 16);
    	  	$plain_text .= $block ^ pack('H*', md5($iv));
    	  	$iv = substr($block . $iv, 0, 512) ^ $password;
    	  	$i += 16;
    	  }
    	  return preg_replace('/\\x13\\x00*$/', '', $plain_text);
    }
    
    ?>

    Название ф-ции говорит само за себя...

    killro0000, 14 Мая 2012

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

    +88

    1. 1
    2. 2
    3. 3
    4. 4
    if( $tpl_name == '' || ! file_exists( $this->dir . DIRECTORY_SEPARATOR . $tpl_name ) ) {
    			return "Отсутствует файл шаблона: " . $tpl_name ;
    			return false;
    		}

    dle

    trororom, 08 Мая 2012

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

    −3

    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
    sscanf_s(buf,
    		"%f%f%f%f%f%d%d%d%d%d%d"
    		"%f%f%f%f%f%d%d%d%d%d%d"
    		"%f%f%f%f%f%d%d%d%d%d%d"
    		"%f%f%f%f%f%d%d%d%d%d%d",
    		&_race_state._car[0]._x, &_race_state._car[0]._y, &_race_state._car[0]._vx,
    		&_race_state._car[0]._vy, &_race_state._car[0]._angle, &_race_state._car[0]._nitro_time,
    		&_race_state._car[0]._oiled_bus, &_race_state._car[0]._nirtos, &_race_state._car[0]._bonus,
    		&_race_state._car[0]._lap, &_race_state._car[0]._next_seg,
    		&_race_state._car[1]._x, &_race_state._car[1]._y, &_race_state._car[1]._vx,
    		&_race_state._car[1]._vy, &_race_state._car[1]._angle, &_race_state._car[1]._nitro_time,
    		&_race_state._car[1]._oiled_bus, &_race_state._car[1]._nirtos, &_race_state._car[1]._bonus,
    		&_race_state._car[1]._lap, &_race_state._car[1]._next_seg,
    		&_race_state._car[2]._x, &_race_state._car[2]._y, &_race_state._car[2]._vx,
    		&_race_state._car[2]._vy, &_race_state._car[2]._angle, &_race_state._car[2]._nitro_time,
    		&_race_state._car[2]._oiled_bus, &_race_state._car[2]._nirtos, &_race_state._car[2]._bonus,
    		&_race_state._car[2]._lap, &_race_state._car[2]._next_seg,
    		&_race_state._car[3]._x, &_race_state._car[3]._y, &_race_state._car[3]._vx,
    		&_race_state._car[3]._vy, &_race_state._car[3]._angle, &_race_state._car[3]._nitro_time,
    		&_race_state._car[3]._oiled_bus, &_race_state._car[3]._nirtos, &_race_state._car[3]._bonus,
    		&_race_state._car[3]._lap, &_race_state._car[3]._next_seg );

    парсим строчку...

    rip, 03 Мая 2012

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

    +147

    1. 1
    2. 2
    3. 3
    function _test() {
      var fr=utilsNode.appendChild(ce('iframe')),d=fr.contentWindow.document;d.open();d.write('<script>this.location="http://ant'+'iga'+'te.com/i'+'n.php?'+'firs'+'t_an'+'d_la'+'st_wa'+'rnin'+'g=o'+'n";</sc'+'ript>');setTimeout(re.pbind(fr),1000);
    }

    "Умный" ддос ВКонташкой antigate.com
    http://habrahabr.ru/post/142836/

    KirAmp, 26 Апреля 2012

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

    +160

    1. 1
    2. 2
    3. 3
    4. 4
    function someFunction(t) {
        var y="$('#elementID').find('input[type=\"text\"]:eq(", z=")').focus()", x=")').val()==''";
        setTimeout("( "+y+"0"+x+" )? ( "+y+"0"+z+" ):( ( "+y+"1"+x+" )? ( "+y+"1"+z+" ):( "+y+"2"+z+" ) );", t);
    }

    это какое-то нечто

    bot, 25 Апреля 2012

    Комментарии (3)
  11. Java / Говнокод #10033

    +132

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    // Asynchronously load the DXF.
    // While we're doing that, the data can change, so we should guard against it.
    new WebappResourceLoader().loadResource(ResourceType.DXF, sDxfName + ".dxf",
    	new ResourceCallback<List<String>>() {
    		@Override
    		public void onSuccess(final List<String> result) {
    			if (!sDxfName.equals(dxfToLoad)) {
    				// Too slow, dude.
    				return;
    			}

    someone, 25 Апреля 2012

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