1. PHP / Говнокод #8715

    +160

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    const ORDER_FUNC_ARGS   = '$a, $b';
    	const ORDER_FUNC_LOGIC  = '$a=strlen($a);$b=strlen($b);return$a==$b?0:($a<$b?1:-1);';
    // а дальше в одном из методов
    		$this->_userAgents 	= array_keys($browsers);
    		usort(
    			$this->_userAgents,
    			create_function(self::ORDER_FUNC_ARGS, self::ORDER_FUNC_LOGIC)
    		);

    Для меня это странно выглядит

    LiteError, 03 Декабря 2011

    Комментарии (0)
  2. ActionScript / Говнокод #8714

    −111

    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
    public class MonstrGrafic extends ModulINT {
    		var data:XML;
    		var colors:Array = new Array(
    			'0x008080',
    			'0x800080',
    			'0xccffcc',
    			'0x00ffff',
    			'0x800000',
    			'0x0000ff',
    			'0x00ccff',
    			'0xccffff',
    			'0xffff00',
    			'0xffff99',
    			'0x000080',
    			'0xff00ff'
    		);
    		var ListTime:Array = new Array(
    			"08:00:00 - 08:15:00",
    			"08:15:00 - 08:30:00",
    			"08:30:00 - 08:45:00",
    			"08:45:00 - 09:00:00",
    			"09:00:00 - 09:15:00",
    			"09:15:00 - 09:30:00",
    			"09:30:00 - 09:45:00",
    			"09:45:00 - 10:00:00",
    			"10:00:00 - 10:15:00",
    			"10:15:00 - 10:30:00",
    			"10:30:00 - 10:45:00",
    			"10:45:00 - 11:00:00",
    			"11:00:00 - 11:15:00",
    			"11:15:00 - 11:30:00",
    			"11:30:00 - 11:45:00",
    			"11:45:00 - 12:00:00",
    			"12:00:00 - 12:15:00",
    			"12:15:00 - 12:30:00",
    			"12:30:00 - 12:45:00",
    			"12:45:00 - 13:00:00",
    			"13:00:00 - 13:15:00",
    			"13:15:00 - 13:30:00",
    			"13:30:00 - 13:45:00",
    			"13:45:00 - 14:00:00",
    			"14:00:00 - 14:15:00",
    			"14:15:00 - 14:30:00",
    			"14:30:00 - 14:45:00",
    			"14:45:00 - 15:00:00",
    			"15:00:00 - 15:15:00",
    			"15:15:00 - 15:30:00",
    			"15:30:00 - 15:45:00",
    			"15:45:00 - 16:00:00",
    			"16:00:00 - 16:15:00",
    			"16:15:00 - 16:30:00",
    			"16:30:00 - 16:45:00",
    			"16:45:00 - 17:00:00",
    			"17:00:00 - 17:15:00",
    			"17:15:00 - 17:30:00",
    			"17:30:00 - 17:45:00",
    			"17:45:00 - 18:00:00",
    			"18:00:00 - 18:15:00",
    			"18:15:00 - 18:30:00",
    			"18:30:00 - 18:45:00",
    			"18:45:00 - 19:00:00",
    			"19:00:00 - 19:15:00",
    			"19:15:00 - 19:30:00",
    			"19:30:00 - 19:45:00",
    			"19:45:00 - 20:00:00",
    			"20:00:00 - 20:15:00",
    			"20:15:00 - 20:30:00",
    			"20:30:00 - 20:45:00",
    			"20:45:00 - 21:00:00",
    			"21:00:00 - 21:15:00",
    			"21:15:00 - 21:30:00",
    			"21:30:00 - 21:45:00",
    			"21:45:00 - 22:00:00",
    			"22:00:00 - 22:15:00",
    			"22:15:00 - 22:30:00",
    			"22:30:00 - 22:45:00",
    			"22:45:00 - 23:00:00",
    			"23:00:00 - 23:15:00",
    			"23:15:00 - 23:30:00",
    			"23:30:00 - 23:45:00",
    			"23:45:00 - 24:00:00"
    		);

    kyzi007, 03 Декабря 2011

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

    +159

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    protected $_never_allowed_regex = array(
    					"javascript\s*:"			=> '[removed]',
    					"expression\s*(\(|&\#40;)"	=> '[removed]', // CSS and IE
    					"vbscript\s*:"				=> '[removed]', // IE, surprise!
    					"Redirect\s+302"			=> '[removed]'
    	);

    Это не разу не ковнокод, но строкой с // IE, surprise! не поделится, не смог)

    ЗЫ. это CodeIgniter 2.0.3 класс Security, строка 52

    Zerstoren, 02 Декабря 2011

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

    −111

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    try{
    	characterParser.parse(_daeXML);
    }catch(e:ScriptTimeoutError){
    	characterParser.parse(_daeXML);
    }

    чувак решил проблему пятнадцати секунд

    makc3d, 02 Декабря 2011

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

    +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
    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
    private function isBonusAddOK($code,$ffStr)
    	{
    		switch($code)
    		{
    			case 1:if(
    						($this->isBFFOK($ffStr,40) || $this->isBFFOK($ffStr,38) || $this->isBFFOK($ffStr,37)) && 
    						$this->isBFFOK($ffStr,24) && $this->isBFFOK($ffStr,19) &&
    						($this->isBFFOK($ffStr,42) || $this->isBFFOK($ffStr,43) || $this->isBFFOK($ffStr,44))
    						)return true;return false;
    						
    			case 6:if(
    						($this->isBFFOK($ffStr,40) || $this->isBFFOK($ffStr,38) || $this->isBFFOK($ffStr,37)) && 
    						$this->isBFFOK($ffStr,24) && $this->isBFFOK($ffStr,20) &&
    						($this->isBFFOK($ffStr,42) || $this->isBFFOK($ffStr,43) || $this->isBFFOK($ffStr,44))
    						)return true;return false;
    						
    			case 11:if(
    						$this->isBFFOK($ffStr,24) &&
    						($this->isBFFOK($ffStr,16) || $this->isBFFOK($ffStr,358) || $this->isBFFOK($ffStr,360) || $this->isBFFOK($ffStr,361)) && 
    						$this->isBFFOK($ffStr,62) &&
    						($this->isBFFOK($ffStr,64) || $this->isBFFOK($ffStr,352) || $this->isBFFOK($ffStr,356) || $this->isBFFOK($ffStr,363)) &&
    						($this->isBFFOK($ffStr,3) || $this->isBFFOK($ffStr,4) || $this->isBFFOK($ffStr,5))
    						)return true;return false;
    						
    			case 14:if(
    						$this->isBFFOK($ffStr,24) &&
    						($this->isBFFOK($ffStr,16) || $this->isBFFOK($ffStr,358) || $this->isBFFOK($ffStr,360) || $this->isBFFOK($ffStr,361)) && 
    						$this->isBFFOK($ffStr,61) &&
    						($this->isBFFOK($ffStr,64) || $this->isBFFOK($ffStr,352) || $this->isBFFOK($ffStr,356) || $this->isBFFOK($ffStr,363)) &&
    						($this->isBFFOK($ffStr,3) || $this->isBFFOK($ffStr,4) || $this->isBFFOK($ffStr,5))
    						)return true;return false;
    			
    			case 17:if(
    						($this->isBFFOK($ffStr,16) || $this->isBFFOK($ffStr,358) || $this->isBFFOK($ffStr,360) || $this->isBFFOK($ffStr,361)) && 
    						($this->isBFFOK($ffStr,64) || $this->isBFFOK($ffStr,352) || $this->isBFFOK($ffStr,356) || $this->isBFFOK($ffStr,363)) &&
    						($this->isBFFOK($ffStr,3) || $this->isBFFOK($ffStr,4) || $this->isBFFOK($ffStr,5)) &&
    						$this->isBFFOK($ffStr,17)
    						)return true;return false;
    			
    			case 20:if(
    						($this->isBFFOK($ffStr,16) || $this->isBFFOK($ffStr,358) || $this->isBFFOK($ffStr,360) || $this->isBFFOK($ffStr,361)) && 
    						($this->isBFFOK($ffStr,64) || $this->isBFFOK($ffStr,352) || $this->isBFFOK($ffStr,356) || $this->isBFFOK($ffStr,363)) &&
    						($this->isBFFOK($ffStr,3) || $this->isBFFOK($ffStr,4) || $this->isBFFOK($ffStr,5)) &&
    						$this->isBFFOK($ffStr,25) && $this->isBFFOK($ffStr,21)
    						)return true;return false;
    						
    			case 23:if(
    						($this->isBFFOK($ffStr,16) || $this->isBFFOK($ffStr,358) || $this->isBFFOK($ffStr,360) || $this->isBFFOK($ffStr,361)) && 
    						($this->isBFFOK($ffStr,64) || $this->isBFFOK($ffStr,352) || $this->isBFFOK($ffStr,356) || $this->isBFFOK($ffStr,363)) &&
    						($this->isBFFOK($ffStr,3) || $this->isBFFOK($ffStr,4) || $this->isBFFOK($ffStr,5)) &&
    						$this->isBFFOK($ffStr,21)
    						)return true;return false;
    						
    						
    		.... еще куча строк до значения 88
    			
    			default: return true;
    		}
    	}
    	
    	private function isBFFOK($ffStr,$pos)
    	{
    		$val = substr($ffStr,$pos,1);//echo $pos.':'.$val;var_dump(($val != '0'));echo ' ';
    		return ($val != '0');
    		/*if($val == 0)return false;

    ИфЗебок

    kyzi007, 02 Декабря 2011

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

    +75

    1. 1
    2. 2
    3. 3
    if(getFillColor().length() > 0){
    		/***/
    	}

    проверка на инициализацию переменной

    JJunior, 02 Декабря 2011

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

    +167

    1. 1
    ( $resultat == 1 AND $resultat != '' AND $resultat != 0 ) ? true : false;

    Что-бы наверняка.

    nethak, 02 Декабря 2011

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

    +164

    1. 1
    2. 2
    3. 3
    4. 4
    $sql = "SELECT (max(nid) + 1) FROM cms_news";
    $MySQL_baza->ExecQuery($sql);
    $myrow=$MySQL_baza->FetchArray();
    $max=$myrow[0];

    Копался в одном старом проекте, не сразу понял зачем нужен следующий код.
    Автоинкримент %)

    MAXHO, 02 Декабря 2011

    Комментарии (31)
  9. Pascal / Говнокод #8707

    +87

    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
    function det5(var a:atab):double;
    {FUNKCIYA VYCHISLYAET OPREDELITEL MATRITSY 5-go PORYADKA a}
    begin
    det5:=
    +a[1,1]*a[2,2]*a[3,3]*a[4,4]*a[5,5]-a[1,2]*a[2,1]*a[3,3]*a[4,4]*a[5,5]
    +a[1,3]*a[2,1]*a[3,2]*a[4,4]*a[5,5]-a[1,1]*a[2,3]*a[3,2]*a[4,4]*a[5,5]
    -a[1,3]*a[2,2]*a[3,1]*a[4,4]*a[5,5]+a[1,2]*a[2,3]*a[3,1]*a[4,4]*a[5,5]
    -a[1,4]*a[2,1]*a[3,2]*a[4,3]*a[5,5]+a[1,1]*a[2,4]*a[3,2]*a[4,3]*a[5,5]
    -a[1,1]*a[2,2]*a[3,4]*a[4,3]*a[5,5]+a[1,4]*a[2,2]*a[3,1]*a[4,3]*a[5,5]
    -a[1,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,4]*a[4,5]*a[5,2]
    +a[1,5]*a[2,4]*a[3,3]*a[4,2]*a[5,1]-a[1,4]*a[2,5]*a[3,3]*a[4,2]*a[5,1]
    +a[1,4]*a[2,3]*a[3,5]*a[4,2]*a[5,1]-a[1,4]*a[2,3]*a[3,2]*a[4,5]*a[5,1]
    -a[1,5]*a[2,3]*a[3,4]*a[4,2]*a[5,1]+a[1,3]*a[2,5]*a[3,4]*a[4,2]*a[5,1]
    -a[1,3]*a[2,4]*a[3,5]*a[4,2]*a[5,1]+a[1,3]*a[2,4]*a[3,2]*a[4,5]*a[5,1]
    +a[1,5]*a[2,3]*a[3,2]*a[4,4]*a[5,1]-a[1,3]*a[2,5]*a[3,2]*a[4,4]*a[5,1]
    +a[1,3]*a[2,2]*a[3,5]*a[4,4]*a[5,1]-a[1,3]*a[2,2]*a[3,4]*a[4,5]....

    Жалко, что вся функця не поместилась.
    Найдено здесь. http://bbi-math.narod.ru/rosenbrock/rosenbrock.html
    Там автор показывает мастерство владения циклами и рекурсиями. А так же демонстрирует каменную выдержку и самообладание, при наборе такого кода.

    antoha_by, 02 Декабря 2011

    Комментарии (31)
  10. Java / Говнокод #8706

    +86

    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
    public void type(char character) {
        	switch (character) {
        	case 'a': doType(VK_A); break;
        	case 'b': doType(VK_B); break;
        	case 'c': doType(VK_C); break;
        	case 'd': doType(VK_D); break;
        	case 'e': doType(VK_E); break;
        	case 'f': doType(VK_F); break;
        	case 'g': doType(VK_G); break;
        	case 'h': doType(VK_H); break;
        	case 'i': doType(VK_I); break;
        	case 'j': doType(VK_J); break;
        	case 'k': doType(VK_K); break;
        	case 'l': doType(VK_L); break;
        	case 'm': doType(VK_M); break;
        	case 'n': doType(VK_N); break;
        	case 'o': doType(VK_O); break;
        	case 'p': doType(VK_P); break;
        	case 'q': doType(VK_Q); break;
        	case 'r': doType(VK_R); break;
        	case 's': doType(VK_S); break;
        	case 't': doType(VK_T); break;
        	case 'u': doType(VK_U); break;
        	case 'v': doType(VK_V); break;
        	case 'w': doType(VK_W); break;
        	case 'x': doType(VK_X); break;
        	case 'y': doType(VK_Y); break;
        	case 'z': doType(VK_Z); break;
        	case 'A': doType(VK_SHIFT, VK_A); break;
        	case 'B': doType(VK_SHIFT, VK_B); break;
        	case 'C': doType(VK_SHIFT, VK_C); break;
        	case 'D': doType(VK_SHIFT, VK_D); break;
        	case 'E': doType(VK_SHIFT, VK_E); break;
    <...>
        	case '$': doType(VK_DOLLAR); break;
        	case '%': doType(VK_SHIFT, VK_5); break;
        	case '^': doType(VK_CIRCUMFLEX); break;
        	case '&': doType(VK_AMPERSAND); break;
        	case '*': doType(VK_ASTERISK); break;
        	case '(': doType(VK_LEFT_PARENTHESIS); break;
        	case ')': doType(VK_RIGHT_PARENTHESIS); break;
        	case '_': doType(VK_UNDERSCORE); break;
        	case '+': doType(VK_PLUS); break;
        	case '\t': doType(VK_TAB); break;
        	case '\n': doType(VK_ENTER); break;
        	case '[': doType(VK_OPEN_BRACKET); break;
        	case ']': doType(VK_CLOSE_BRACKET); break;
        	case '\\': doType(VK_BACK_SLASH); break;
        	case '{': doType(VK_SHIFT, VK_OPEN_BRACKET); break;
        	case '}': doType(VK_SHIFT, VK_CLOSE_BRACKET); break;
        	case '|': doType(VK_SHIFT, VK_BACK_SLASH); break;
        	case ';': doType(VK_SEMICOLON); break;
        	case ':': doType(VK_COLON); break;
        	case '\'': doType(VK_QUOTE); break;
        	case '"': doType(VK_QUOTEDBL); break;
        	case ',': doType(VK_COMMA); break;
        	case '<': doType(VK_LESS); break;
        	case '.': doType(VK_PERIOD); break;
        	case '>': doType(VK_GREATER); break;
        	case '/': doType(VK_SLASH); break;
        	case '?': doType(VK_SHIFT, VK_SLASH); break;
        	case ' ': doType(VK_SPACE); break;
        	default:

    http://stackoverflow.com/questions/1248510/convert-string-to-keyevents
    Конвертируем символы в клавиши.
    Боян, да. Но теперь на джаве. Кстати, автор забыл про toLower и toUpper.

    RaZeR, 01 Декабря 2011

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