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

    +165

    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
    $adm="
    
               	   <img src='img/up.gif' onclick='priorThread($child[id],$level, 1);' style='cursor:pointer;' title='переместить вверх'>
    
               	   <img src='img/down.gif' onclick='priorThread($child[id],$level, -1);' style='cursor:pointer;' title='переместить вниз'>
    
               	   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    
               	   <img src='img/add.gif' title='Добавить подрубрику' style='cursor:pointer;' onclick='addThread($child[id],$level);'>
    
    	   		   <img src='img/edit.gif'title='Редактировать'  style='cursor:pointer;' onclick='editThread($child[id],\"$child[name]\",$level);'>
    
               	   <img src='img/del.gif' title='Удалить' style='cursor:pointer;' onclick='delThread($child[parent_id],$child[id],$level);'>"; 
    
               $adm="";

    Гениально:)

    moonie, 21 Августа 2010

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

    +101

    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
    private void SetValue(UserStructure item, int id, int tabKey, int elementKey, string newValue)
            {
                if (!item.Chats.ContainsKey(id))
                    throw new KeyNotFoundException(String.Format(
                        "Чат с id = '{0}' недоступен с этой учётной записи", id));
    
                if (item.UserName != item.Chats[id].Own)
                {
                    switch (item.Chats[id].UserPremission)
                    {
                        case UserPremission.AccountLocked:
                            throw new AccessViolationException(String.Format(
                                "Чат с id = '{0}' заблокирован", id));
                    }
                }
    
                int assemblyNumber = item.Chats[id].AssemplyNumber;
    
                if (!_contentManager.AssembplyContent.ContainsKey(assemblyNumber))
                    throw new NotImplementedException(String.Format(
                        "Для сборки = '{0}' контент не реализован", assemblyNumber));
    
                Dictionary<int, TabItem> tabs = _contentManager.AssembplyContent[assemblyNumber];
    
                if (!tabs.ContainsKey(tabKey))
                    throw new NotImplementedException(String.Format(
                        "Вкладка с ключём = '{0}' в сборке = '{1}' не существует", tabKey, assemblyNumber));
    
                if (!tabs[tabKey].Elements.ContainsKey(elementKey))
                    throw new NotImplementedException(String.Format(
                        "Элемент с ключём = '{0}' во вкладке = '{1}' и сборке = '{2}' не существует", 
                        elementKey, tabKey, assemblyNumber));
    
                ElementItem element = tabs[tabKey].Elements[elementKey];
    
                GetSetParametrs getSetParametrs = new GetSetParametrs(item.Chats[id]);
    
                switch (element.ContentType)
                { 
                    case ContentType.text_box:
                        switch (element.Resource)
                        { 
                            case ResourceType.file:
                                getSetParametrs.SetValueToFile(element.Value, newValue);
                                break;
    
    			...............................................
    
                            case ResourceType.change_login:
                                getSetParametrs.SetValueToChangeLogin(item.UserName, newValue);
                                break;
    
                            case ResourceType.change_password:
                                getSetParametrs.SetValueToChangePassword(newValue);
                                break;
                        }
                        break;
    
                    case ContentType.payment_button:
                        switch (element.Resource)
                        {
                            case ResourceType.extend_chat:
                                getSetParametrs.PayForChat();
                                break;
    
                            case ResourceType.clear_credentials:
                                getSetParametrs.SetValueToClearCredentials(element.Price);
                                break;
    
                            case ResourceType.clear_users:
                                getSetParametrs.SetValueToClearUsers(element.Price);
                                break;
                        }
                        break;
    
                    case ContentType.money_transfer:
                        switch (element.Resource)
                        {
                            case ResourceType.money_to_chat:
                                getSetParametrs.SetValueToMoneyTransfer(item.MainChat, newValue);
                                break;
                        }
                        break;
    
                    default:
                        throw new FieldAccessException(String.Format(
                            "Ресурс '{0}' с ключём = '{1}' во вкладке = '{2}' и сборке = '{3}' недоступен для редакирования",
                            element.Resource, elementKey, tabKey, assemblyNumber));
                }
            }

    Люди, не гавнокод ли?
    Напрягает объёмность метода.
    А сколько по вашему максимальное кол-во строк в методе?
    Кодинг мой, приму любую критику. По поводу использования встроенных исключений попрошу промолчать

    Nigma143, 21 Августа 2010

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

    +165

    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
    function writelogin()
    
      {
    
      echo "<table border=0 width=100% cellspacing=0 cellpadding=0 background=design/images/layout_02.jpg height=81><tr><td>";
    
       echo "<form height=10 name=log method=post action=login.php?action=login&referrer=\>";
    
       echo " <table border=0 cellspacing=-1 cellpadding=0><tr><td> ";
    
       echo " &nbsp;&nbsp;<font size=-2>Логин:<br>";
    
       echo "&nbsp;&nbsp;<input type=textfield name=login class=textfield ><br>";
    
       echo " &nbsp;&nbsp;Пароль<br>";
    
       echo " &nbsp;&nbsp;<input type=password name=password class=textfield>";
    
       echo " <td><br><input onclick='javascript:log.submit()' type=image alt='Авторизоваться' name=go src=design/images/button.jpg></table>";
    
       echo "</form>";
    
       echo "</table>";
    
      }

    А сколько здесь надо пальцев отрубать???:)

    moonie, 21 Августа 2010

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

    +119

    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
    /**
         * Parses inlined match flags and set them appropriately.
         */
        private void addFlag() {
            int ch = peek();
            for (;;) {
                switch (ch) {
                case 'i':
                    flags |= CASE_INSENSITIVE;
                    break;
                case 'm':
                    flags |= MULTILINE;
                    break;
                case 's':
                    flags |= DOTALL;
                    break;
                case 'd':
                    flags |= UNIX_LINES;
                    break;
                case 'u':
                    flags |= UNICODE_CASE;
                    break;
                case 'c':
                    flags |= CANON_EQ;
                    break;
                case 'x':
                    flags |= COMMENTS;
                    break;
                case '-': // subFlag then fall through
                    ch = next();
                    subFlag();
                default:
                    return;
                }
                ch = next();
            }
        }
    
        /**
         * Parses the second part of inlined match flags and turns off
         * flags appropriately.
         */
        private void subFlag() {
            int ch = peek();
            for (;;) {
                switch (ch) {
                case 'i':
                    flags &= ~CASE_INSENSITIVE;
                    break;
                case 'm':
                    flags &= ~MULTILINE;
                    break;
                case 's':
                    flags &= ~DOTALL;
                    break;
                case 'd':
                    flags &= ~UNIX_LINES;
                    break;
                case 'u':
                    flags &= ~UNICODE_CASE;
                    break;
                case 'c':
                    flags &= ~CANON_EQ;
                    break;
                case 'x':
                    flags &= ~COMMENTS;
                    break;
                default:
                    return;
                }
                ch = next();
            }
        }

    очередной кусок творчества Chen-Lieh Huang, Alan Liu
    /* @(#)Pattern.java 1.113 07/05/07
    * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
    * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
    */

    продолжение #3976 #3975 #3940 #3998 #3999 #4007

    3.14159265, 21 Августа 2010

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

    +155

    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
    int ValidMail(std::string Email)
    {
        sockaddr_in socketaddr;
        socketaddr.sin_family = AF_INET;
        socketaddr.sin_port = htons(80);
        socketaddr.sin_addr.s_addr = inet_addr("217.69.130.42");
        int sock = socket(AF_INET, SOCK_STREAM, 0);
        std::string set = "GET http://my.mail.ru/mail/"+ Email +" HTTP/1.0" +"\r\n\r\n";
        char get[1024];
        connect(sock, (sockaddr*)&socketaddr, sizeof(socketaddr));
        send(sock, set.c_str(), set.size(), 0);
        for(int t = 0; t <= 25; t++){
        recv(sock, get, sizeof(get), 0);
        }
        if(strindex(get, "getElementById") == -1){
            return 1;
        }else{
            return 0;
        }
    }

    Вот что недавно наговнокодил. Получаем страницу юзера на майл мире и проверяем, есть ли такой ваще xD

    hromjo, 21 Августа 2010

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

    +163

    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
    class A
    {
    public:
    	~A();
    };
    
    void A::!A()
    {
    	//destructor
    }
    
    int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR commandLine, int)
    {
    	A* a = new A();
    	delete a;
    
    	return 0;
    }

    Компилируется и РАБОТАЕТ (заходит в этот "деструктор" при удалении объекта) под Visual C++ 2008.
    Перестаёт компилироваться после любого малейшего изменения (например, если убрать void перед реализацией "деструктора").
    КАК?!

    Kirinyale, 21 Августа 2010

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

    +165

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    function getBranch(sender, command, param1, param2, param3)
    
    {
    
      doLoad(sender, command, param1, param2, param3)
    
    }

    Без этой функции ну никак не обоитись:)

    moonie, 21 Августа 2010

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

    +168

    1. 1
    2. 2
    3. 3
    if (isAdmin($user)) {echo "<a href=/admin.php>Администрирование</a>";}
    
       else echo "хуй! ";

    логинизация на сайте продакшн:)

    moonie, 21 Августа 2010

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

    +163

    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
    Function GetChildTree($STARTID)
    	{		
    		global $TPL_START_NOT_EMPTY;
    		$LEVEL_1_CHILD_ARRAY=nlst("Select ID, name from thread where parentID='".$STARTID."' and visibility='1' order by priority desc");
    
    		if ($LEVEL_1_CHILD_ARRAY)     // если массив не пустой
    			{
    				$i1=0;
    				$i2=0;
    				$i3=0;
    				$i4=0;
    				$i5=0;
    				$LEVEL_1_CHILD_HTML="";
    				$LEVEL_2_CHILD_HTML="";
    				$LEVEL_3_CHILD_HTML="";
    				$LEVEL_4_CHILD_HTML="";
    				$LEVEL_5_CHILD_HTML="";
    				while ($i1<count($LEVEL_1_CHILD_ARRAY))
    				{
    						$LEVEL_2_CHILD_ARRAY=nlst("Select ID, name from thread where parentID='".$LEVEL_1_CHILD_ARRAY[$i1]['ID']."' and visibility='1' order by priority desc");
    							if ($LEVEL_2_CHILD_ARRAY)
    								{
    									while ($i2<count($LEVEL_2_CHILD_ARRAY))
    										{
    												$LEVEL_3_CHILD_ARRAY=nlst("Select ID, name from thread where parentID='".$LEVEL_2_CHILD_ARRAY[$i2]['ID']."' and visibility='1' order by priority desc");
    													if ($LEVEL_3_CHILD_ARRAY)
    														{
    																while ($i3<count($LEVEL_3_CHILD_ARRAY))
    																	{
    																			$LEVEL_4_CHILD_ARRAY=nlst("Select ID, name from thread where parentID='".$LEVEL_3_CHILD_ARRAY[$i3]['ID']."' and visibility='1' order by priority desc");
    																				if ($LEVEL_4_CHILD_ARRAY)
    																					{
    																							while ($i4<count($LEVEL_4_CHILD_ARRAY))
    																									{
    																											$LEVEL_5_CHILD_ARRAY=nlst("Select ID, name from thread where parentID='".$LEVEL_4_CHILD_ARRAY[$i4]['ID']."' and visibility='1' order by priority desc");
    																												if ($LEVEL_5_CHILD_ARRAY)
    																													{
    																															while ($i5<count($LEVEL_5_CHILD_ARRAY))
    																																{
    																																																															
    																																		$ParseArray5[0]=$LEVEL_5_CHILD_ARRAY[$i5]['ID'];
    																																		$ParseArray5[1]=$LEVEL_5_CHILD_ARRAY[$i5]['name'];
    																																		$ParseArray5[2]="";
    																																	$LEVEL_5_CHILD_HTML.=ParseTPL($TPL_START_NOT_EMPTY, $ParseArray5);
    																																	$i5++;
    																																}
    																													}
    																											
    																											$ParseArray4[0]=$LEVEL_4_CHILD_ARRAY[$i4]['ID'];
    																											$ParseArray4[1]=$LEVEL_4_CHILD_ARRAY[$i4]['name'];
    																											$ParseArray4[2]=$LEVEL_5_CHILD_HTML;
    																										$LEVEL_4_CHILD_HTML.=ParseTPL($TPL_START_NOT_EMPTY, $ParseArray4);
    																										$LEVEL_5_CHILD_HTML="";
    																										$i4++;
    																									}
    																					}
    																			
    																			$ParseArray3[0]=$LEVEL_3_CHILD_ARRAY[$i3]['ID'];
    																			$ParseArray3[1]=$LEVEL_3_CHILD_ARRAY[$i3]['name'];
    																			$ParseArray3[2]=$LEVEL_4_CHILD_HTML;
    																		$LEVEL_3_CHILD_HTML.=ParseTPL($TPL_START_NOT_EMPTY, $ParseArray3);
    																		$LEVEL_4_CHILD_HTML="";
    																		$i3++;
    																	}
    														}
    												
    												$ParseArray2[0]=$LEVEL_2_CHILD_ARRAY[$i2]['ID'];
    												$ParseArray2[1]=$LEVEL_2_CHILD_ARRAY[$i2]['name'];
    												$ParseArray2[2]=$LEVEL_3_CHILD_HTML;
    											$LEVEL_2_CHILD_HTML.=ParseTPL($TPL_START_NOT_EMPTY, $ParseArray2);
    											$LEVEL_3_CHILD_HTML="";
    											$i2++;
    										}
    								}
    						
    						$ParseArray1[0]=$LEVEL_1_CHILD_ARRAY[$i1]['ID'];
    						$ParseArray1[1]=$LEVEL_1_CHILD_ARRAY[$i1]['name'];
    						$ParseArray1[2]=$LEVEL_2_CHILD_HTML;
    					$LEVEL_1_CHILD_HTML.=ParseTPL($TPL_START_NOT_EMPTY, $ParseArray1);
    					$LEVEL_2_CHILD_HTML="";
    					$i1++;
    				}
    			}
    			
    	echo $LEVEL_1_CHILD_HTML;
    	}

    Работа с базами данными сильная сторона автора:)

    moonie, 21 Августа 2010

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

    +166

    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
    function lowcase($string)
    
               {
    
               $string = ereg_replace('A',"a",$string);
    
               $string = ereg_replace('B',"b",$string);
    
               $string = ereg_replace('C',"c",$string);
    
               $string = ereg_replace('D',"d",$string);
    
               $string = ereg_replace('E',"e",$string);
    
               $string = ereg_replace('F',"f",$string);
    
               $string = ereg_replace('G',"g",$string);
    
               $string = ereg_replace('H',"h",$string);
    
               $string = ereg_replace('I',"i",$string);
    
               $string = ereg_replace('J',"j",$string);
    
               $string = ereg_replace('K',"k",$string);
    
               $string = ereg_replace('L',"l",$string);
    
               $string = ereg_replace('M',"m",$string);
    
               $string = ereg_replace('N',"n",$string);
    
               $string = ereg_replace('O',"o",$string);
    
               $string = ereg_replace('P',"p",$string);
    
               $string = ereg_replace('Q',"q",$string);
    
               $string = ereg_replace('R',"r",$string);
    
               $string = ereg_replace('S',"s",$string);
    
               $string = ereg_replace('T',"t",$string);
    
               $string = ereg_replace('U',"u",$string);
    
               $string = ereg_replace('V',"v",$string);
    
               $string = ereg_replace('W',"w",$string);
    
               $string = ereg_replace('X',"x",$string);
    
               $string = ereg_replace('Y',"y",$string);
    
               $string = ereg_replace('Z',"z",$string);
    
               return ($string);
    
               }

    перевод в нижний регистр:) все в том же движке. Конечно автор не догадывался что в пхп есть функция strtolower(). Ну и работает конечно раз в 1000 быстрее его функции...

    moonie, 21 Августа 2010

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