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

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

    +1

    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
    if($form_action=="register") {
       if($coo_coo=="tootoo") {
       if($myusername) {
          if($mypassword) {
             if($mypassword==$myrepeat) {
                $uLength = strlen($myusername);
                $pLength = strlen($mypassword);
                if($uLength >= 3 && $uLength <= 30) {
                   $return_error = "";
                } else {
                   $return_error = "Username must be between 3 and 30 characters.";
                }
                if($pLength >= 3 && $pLength <= 30) {
                   $return_error = "";
                } else {
                   $return_error = "Password must be between 3 and 30 characters.";
                }
                if($return_error == "") {
                   if($db_found) {
                      $mypassword = md5($mypassword);
                      $SQL = "SELECT * FROM users WHERE username='$myusername'";
                      $result = mysql_query($SQL);
                      $num_rows = mysql_num_rows($result);
                      if($num_rows==1) {
                         $return_error = "Username already taken.";
                      } else {
                         if(!mysql_query("INSERT INTO users (id,date,ip,username,password) VALUES ('','$date','$ip','$myusername','$mypassword')")){
                            $return_error = "System error.";
                         } else {
                            $return_error = "Logged in.";
                            $_SESSION['user_session'] = $myusername;
                            header ("Location: index.php");
                         }
                      }
                   }
                }
             } else {
                $return_error = "Passwords did not match";
             }
          } else {
             $return_error = "No password was entered.";
          }
       } else {
          $return_error = "No username was entered.";
       }
       } else {
          $return_error = "Registrations are disabled.";
       }
    }

    "Сам кусок регистрации"
    Ошибка начинается с первой строки...

    MouseZver, 21 Декабря 2018

    Комментарии (31)
  3. Куча / Говнокод #25208

    +1

    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
    ;;; the toplevel operators of each equation in the system
    ;;; type : array[term]
    (defmacro match-acz-state-methods (state__) `(svref ,state__ 0))
    
    ;;; functional terms
    ;;; type : array[term]
    (defmacro match-acz-state-lhs-f (state__) `(svref ,state__ 1))
    
    ;;; variables on the LHS
    ;;; type : array[term]
    (defmacro match-acz-state-lhs-v (state__) `(svref ,state__ 2))
    
    ;;; contants on the RHS
    ;;; type : array[term]
    (defmacro match-acz-state-rhs-c (state__) `(svref ,state__ 3))
    
    ;;; functional terms on RHS
    ;;; type : array[term]
    (defmacro match-acz-state-rhs-f (state__) `(svref ,state__ 4))
    
    ;;; notes repeated functional terms of LHS
    ;;; type : array[bool]
    (defmacro match-acz-state-lhs-f-r (state__) `(svref ,state__ 5))
    
    ;;; notes repeated variables of LHS
    ;;; type : array[bool]
    (defmacro match-acz-state-lhs-v-r (state__) `(svref ,state__ 6))
    
    ;;; notes repeated constants of RHS
    ;;; type : array[bool]
    (defmacro match-acz-state-rhs-c-r (state__) `(svref ,state__ 7))
    
    ;;; notes repreated funcational terms of RHS
    ;;; type : array[bool]
    (defmacro match-acz-state-rhs-f-r (state__) `(svref ,state__ 8))
    
    ;;; variables and funs acocunted for by RHS-c-sol
    ;;; type : fixnum
    (defmacro match-acz-state-lhs-mask (state__)  `(svref ,state__ 9))
    
    ;;; funs accounted for by RHS-c-sol
    ;;; type : fixnum
    (defmacro match-acz-state-lhs-f-mask (state__) `(svref ,state__ 10))
    
    ;;; bit vector of all repeated (> 0) terms on LHS
    (defmacro match-acz-state-lhs-r-mask (state__)  `(svref ,state__ 11))
    
    ;;; solution matrix for constants
    ;;; type : array[fixnum]
    (defmacro match-acz-state-rhs-c-sol (state__) `(svref ,state__ 12 ))
    
    ;;; max value of elements of RHS-C-sol
    ;;; type : fixnum
    (defmacro match-acz-state-rhs-c-max (state__) `(svref ,state__ 13))
    
    ;;; solutions matrix; functional terms
    ;;; type : array[fixnum]
    (defmacro match-acz-state-rhs-f-sol (state__) `(svref ,state__ 14))
    
    ;;; max value of elements of RHS-f-sol
    ;;; type : fixnum
    (defmacro match-acz-state-rhs-f-max (state__) `(svref ,state__ 15))
    
    ;;; type : fixnum 11111 ... 1111
    (defmacro match-acz-state-rhs-full-bits (state__) `(svref ,state__ 16))
    
    ;;; array of compatibility bitvectors; constants
    ;;; type : array[fixnum]
    (defmacro match-acz-state-rhs-c-compat (state__) `(svref ,state__ 17))
    
    ;;; array of compatibility bitvectors; funcs
    ;;; type : array[fixnum]
    (defmacro match-acz-state-rhs-f-compat (state__) `(svref ,state__ 18))
    
    ;;; number of constants on LHS after simplification
    ;;; type : fixnum
    (defmacro match-acz-state-lhs-c-count (state__) `(svref ,state__ 19))
    
    ;;; number of functions on LHS after simplification
    ;;; type : fixnum
    (defmacro match-acz-state-lhs-f-count (state__) `(svref ,state__ 20))
    
    ;;; number of variables on LHS after simplification
    ;;; type : fixnum
    (defmacro match-acz-state-lhs-v-count (state__) `(svref ,state__ 21))
    
    ;;; number of constants on RHS after simplification
    ;;; type : fixnum
    (defmacro match-acz-state-rhs-c-count (state__)  `(svref ,state__ 22))
    
    ;;; number of functions on RHS after simplification
    ;;; type : fixnum
    (defmacro match-acz-state-rhs-f-count (state__) `(svref ,state__ 23))
    
    ;;; t iff all solutions have been reported.
    (defmacro match-acz-state-no-more (state__) `(svref ,state__ 24))

    https://github.com/CafeOBJ/cafeobj/blob/master/chaos/e-match/match-acz.lisp

    ГОМОИКОНЫ копипаст лиспе
    CafeOBJ is a most advanced formal specification language which inherits many advanced features (e.g. flexible mix-fix syntax, powerful and clear typing system with ordered sorts, parameteric modules and views for instantiating the parameters, and module expressions, etc.) from OBJ (or more exactly OBJ3) algebraic specification language.

    CafeOBJ is a language for writing formal (i.e. mathematical) specifications of models for wide varieties of software and systems, and verifying properties of them. CafeOBJ implements equational logic by rewriting and can be used as a powerful interactive theorem proving system. Specifiers can write proof scores also in CafeOBJ and doing proofs by executing the proof scores.

    CafeOBJ has state-of-art rigorous logical semantics based on institutions. The CafeOBJ cube shows the structure of the various logics underlying the combination of the various paradigms implemented by the language. Proof scores in CafeOBJ are also based on institution based rigorous semantics, and can be constructed using a complete set of proof rules

    j123123, 20 Декабря 2018

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

    +1

    1. 1
    https://imgur.com/a/IgqXRK7

    BelCodeMonkey, 13 Декабря 2018

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

    +1

    1. 1
    Откуда пошло выражение "... тебе за щеку, проверь"?

    LinuxGovno, 13 Декабря 2018

    Комментарии (20)
  6. Python / Говнокод #25181

    +1

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    def enum(x):
        globals().update(map(reversed, enumerate(x.split())))
    
    enum("""
        ONE
        TWO
        THREE
        FORTH
    """)

    Forth влияет...

    666_N33D135, 12 Декабря 2018

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

    +1

    1. 1
    Вот так пишут настоящие программисты внутри HTML. Ни грамма жалости... Ни слова унижения.

    ...
    <h6 class="card-subtitle">

    <?php switch($cur_user['school_type']):
    case 1: ?>
    <?php echo $lang['Public_school']; ?>
    <?php break; ?>
    <?php case 2: ?>
    <?php echo $lang['State_religious_school']; ?>
    <?php break; ?>
    <?php case 3: ?>
    <?php echo $lang['muslim']; ?>
    <?php break; ?>
    <?php case 4: ?>
    <?php echo $lang['orthodox']; ?>
    <?php break; ?>
    <?php endswitch; ?>

    </h6>
    ...

    gonext, 10 Декабря 2018

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

    +1

    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
    initNumber = 1;
    initNumber2 = 2;
    initNumber3 = 3;
    
    
    
    var  leftbutton = document.getElementById('leftbutton');
    leftbutton.addEventListener('click',sliderleft);
    
    function sliderleft()
    {
    var slider_object_1 =  document.getElementById('slider_object_1');
    var slider_object_2 =  document.getElementById('slider_object_2');
    var slider_object_3 =  document.getElementById('slider_object_3');
    
    
    
    initNumber ++;
    initNumber2 ++;
    initNumber3 ++;
    
    
    if(initNumber>3)
    {
      initNumber = 1;
    }
    if(initNumber2>3)
    {
      initNumber2 = 1;
    }
    if(initNumber3>3)
    {
    initNumber3 = 1;
    } 
    
    
    slider_object_1.setAttribute('src', 'img/' + initNumber  +".PNG");
    slider_object_2.setAttribute('src','img/' + (initNumber2) +".PNG");
    slider_object_3.setAttribute('src','img/' + (initNumber3) +".PNG");
    
    
    
    }

    Мой божественный слайдер, плиз кил ми

    govnokod_v_heart, 09 Декабря 2018

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

    +1

    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
    <?php
    
    function array_rot(&$butterbrot) {
        $rosenrot = array_shift($butterbrot);
        array_push($butterbrot, $rosenrot);
    }
    
    function mutate($hydra, $head) {
        if (count($hydra) < 1) {
            yield [$head];
        }
        foreach($hydra as $branch) {
          $branch[] = $head;
          for ($i = 0; $i < count($branch); ++$i) {
            array_rot($branch);
            yield $branch;
          }
        }
    }
    
    class YOBAMaster {
        private $data = [];    
        public function __get($name) {
            $tmp = [];
            foreach (mutate($this->data, $name) as $variant) {
                $tmp[] = $variant;
            }
            $this->data = $tmp;
            return $this;
        }
        public function say() {
            foreach ($this->data as $item) {
                echo implode(' ', $item) . PHP_EOL;
            }
            $this->data = [];
        }
    }
    
    $master = new YOBAmaster();
    
    $master->ALLO->YOBA->ETO->TI->say();
    
    $master->YOBI->NET->DOMA->say();

    https://ideone.com/aoZ9PX

    YOBAMaster, 08 Декабря 2018

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

    +1

    1. 1
    2. 2
    3. 3
    if (!is_null($model->parent_id)) {
                    $id = FaqCategory::find()->where(["id" => $model->parent_id])->one()->id;
    }

    Как получить ID дочерней категории, которое у вас уже есть

    den_rad, 05 Декабря 2018

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

    +1

    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
    // HooksList.h
    #define PPCAT_NX(A, B) A ## B
    #define PPCAT(A, B) PPCAT_NX(A, B)
    
    #ifdef HOOKS_DEFS
        using namespace NtStructs;
        #define API_HOOK_DEF(module_name, hook_name, return_type, enabled, ...) \
            typedef return_type(WINAPI *PPCAT(hook_name, _ptr))(__VA_ARGS__); \
            return_type WINAPI PPCAT(hook_name, _hook)(__VA_ARGS__); \
            extern PPCAT(hook_name, _ptr) PPCAT(hook_name, _orig);
    #elif defined(HOOKS_LIST)
        #define API_HOOK_DEF(module_name, hook_name, return_type, enabled, ...) \
            {module_name, #hook_name, (LPVOID)PPCAT(hook_name, _hook), (LPVOID*)&PPCAT(hook_name, _orig), enabled},
    #elif defined(HOOKS_TYPES_DEF)
        using namespace NtStructs;
        #define API_HOOK_DEF(module_name, hook_name, return_type, enabled, ...) \
            typedef return_type(WINAPI *PPCAT(hook_name, _ptr))(__VA_ARGS__); \
            return_type WINAPI PPCAT(hook_name, _hook)(__VA_ARGS__);
    #elif defined(ORIGINAL_FUNCTIONS_TABLE_DEF)
        #define API_HOOK_DEF(module_name, hook_name, return_type, enabled, ...) \
            PPCAT(hook_name, _ptr) hook_name;
    #elif defined(ORIGINAL_FUNCTIONS_TABLE_FILL)
        #define API_HOOK_DEF(module_name, hook_name, return_type, enabled, ...) \
            (ORIGINAL_FUNCTIONS_TABLE_NAME).hook_name = PPCAT(hook_name, _orig);
    #else
        #define API_HOOK_DEF(...)
    #endif
    
    // NtCreateFile
    API_HOOK_DEF(L"ntdll", NtCreateFile, NTSTATUS, true,
                 PHANDLE            FileHandle,
                 ACCESS_MASK        DesiredAccess,
                 POBJECT_ATTRIBUTES ObjectAttributes,
                 PIO_STATUS_BLOCK   IoStatusBlock,
                 PLARGE_INTEGER     AllocationSize,
                 ULONG              FileAttributes,
                 ULONG              ShareAccess,
                 ULONG              CreateDisposition,
                 ULONG              CreateOptions,
                 PVOID              EaBuffer,
                 ULONG              EaLength)
    
    // NtDeleteFile
    API_HOOK_DEF(L"ntdll", NtDeleteFile, NTSTATUS, true,
                 POBJECT_ATTRIBUTES ObjectAttributes)
    // И так далее
    
    // В .cpp:
    static HookEntry hookEntries[] = {
    #define HOOKS_LIST
    #include "HooksList.h"
    #undef HOOKS_LIST
    };
    
    
    // ...
    static OriginalFunctions originalFuncsTable;
    #define ORIGINAL_FUNCTIONS_TABLE_FILL 1
    #define ORIGINAL_FUNCTIONS_TABLE_NAME originalFuncsTable
    #include "HooksList.h"
    #undef ORIGINAL_FUNCTIONS_TABLE_NAME
    #undef ORIGINAL_FUNCTIONS_TABLE_FILL

    Мокросы!..

    gost, 30 Ноября 2018

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