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

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

    +34.2

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    #Проверяем тест браузер
    function user_brouser(){
    global $HTTP_USER_AGENT;
    $agent=$HTTP_USER_AGENT;
    if(strlen($agent)>2&&!strstr($agent,'MSIE')){$br="Netscape";}
    else{if($agent!=str_replace("Opera","",$agent)){$br="Opera";}
    else{$br="IE";}}
    if($br!="IE"){
    echo"Для корректной работы нашего ресурса требуется Internet Explorer версии не ниже 6.0 !";
    exit();
    }
    }

    Вот так вот жестко.

    guest, 14 Декабря 2008

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

    +31

    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
    function id($code){
    $id=@m_q("select id from `id`")+1;
    @lng();
    mysql_query("UPDATE `id` SET `id` = '$id', `odin` = '1' WHERE odin = '1'");
    $id="$id";$r="$id";$r_k=strlen($r);
    $m="";
    $m_k=strlen($m);$s=$m_k-$r_k;
    $t=substr($m,0,$s);$id="$t$id";
    $old_id="$id";
    if(isset($code)):$id=md5($id);
    $id=substr($id,0,18);$id="$id";
    endif;return $id;
    }

    Такое сложно комментировать.

    guest, 14 Декабря 2008

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

    +18

    1. 1
    throw new Exception("Унылое говно");

    планируются ли вообще меры по очистке ресурса от унылого говна, дабы поддерживать подборку качественного фекалия? типа, если в минусе более трёх дней, то delete[].

    guest, 14 Декабря 2008

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

    −71.9

    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
    // get today's date string as YYYY-MM-DD HH:MM:SS
    
       function getDateTime(){
           $datetime = getdate();
           $mday = $datetime['mday'];
           if ($mday<10){
               $mday="0$mday";
           }
           $mon = $datetime['mon'];
           if ($mon<10){
               $mon="0$mon";
           }
           $year = $datetime['year'];
           $mhour = $datetime['hours'];
           if ($mhour<10){
               $mhour="0$mhour";
           }
           $mmin = $datetime['minutes'];
           if ($mmin<10){
               $mmin="0$mmin";
           }
           $msec = $datetime['seconds'];
           if ($msec<10){
               $msec="0$msec";
           }
    
           $dateTime = "$year-$mon-$mday $mhour:$mmin:$msec";
           return $dateTime;
       }

    Китайский код самый беспощадный...

    guest, 12 Декабря 2008

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

    +30

    1. 1
    2. 2
    clsLine L = Lines[4][i];
    int Ind = Lines[4].IndexOf(L);

    guest, 12 Декабря 2008

    Комментарии (5)
  7. SQL / Говнокод #74

    −417.7

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    SELECT FROM Staff
      CASE Sex
      WHEN 'M' THEN 'МужЫк!'
      WHEN 'F' THEN 'Баба'
      ELSE 'ЫЫЫыы?'

    препод сказал что елсе не будет выполняться изза ограничений целостности базы

    guest, 08 Декабря 2008

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

    +33.5

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    <script>
    function changeLogo(imgLoc){
        document.getElementById("module_logo").src = "./site/" + imgLoc + "_logo.jpg";
    }
    function returnLogo(imgLoc){
        document.getElementById("module_logo").src = "./site/" + imgLoc + "_logo.jpg";
    }
    </script>

    guest, 08 Декабря 2008

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

    0

    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
    #define IMAGE_BASE_RELOC_TYPE 0x0C
    #define IMAGE_BASE_RELOC_OFFSET 0x0FFF
    #define IMAGE_GET_BASE_RELOC_TYPE(entry) entry >> IMAGE_BASE_RELOC_TYPE
    #define IMAGE_GET_BASE_RELOC_OFFSET(entry) entry & IMAGE_BASE_RELOC_OFFSET
    
    __declspec(safebuffers) __declspec(noinline) DWORD mapping_code(LPVOID map_struct)
    {
    	auto map = static_cast<MM_DATA*>(map_struct);
    
    	auto base = map->base;
    
    	auto dos = reinterpret_cast<PIMAGE_DOS_HEADER>(base);
    	auto nt_headers = reinterpret_cast<PIMAGE_NT_HEADERS>(base + dos->e_lfanew);
    
    	auto opt_header = &nt_headers->OptionalHeader;
    	auto file_header = &nt_headers->FileHeader;
    
    	const bool has_entry_point = opt_header->AddressOfEntryPoint != 0;
    	auto dll_main = reinterpret_cast<DllMainFn>(base + opt_header->AddressOfEntryPoint);
    
    	auto load_library			= map->load_library;
    	auto get_proc_address		= map->get_proc_address;
    	auto virtual_protect		= map->virtual_protect;
    	auto rtl_add_function_table = map->rtl_add_function_table;
    	
    	auto reloc_dir = opt_header->DataDirectory[IMAGE_DIRECTORY_ENTRY_BASERELOC];
    	auto location_delta = reinterpret_cast<uintptr_t>(base) - static_cast<uintptr_t>(opt_header->ImageBase);
    	
    	if (location_delta && reloc_dir.Size)
    	{
    		auto reloc_begin = reinterpret_cast<PIMAGE_BASE_RELOCATION>(base + reloc_dir.VirtualAddress);
    		auto reloc_end = reinterpret_cast<PIMAGE_BASE_RELOCATION>(reinterpret_cast<std::byte*>(reloc_begin) + reloc_dir.Size);
    
    		while (reloc_begin < reloc_end && reloc_begin->SizeOfBlock)
    		{
    			auto amount_of_entries = (reloc_begin->SizeOfBlock - sizeof(IMAGE_BASE_RELOCATION)) / sizeof(WORD);
    
    			auto entries = reinterpret_cast<PWORD>(reloc_begin + 1);
    
    			for (size_t i = 0; i < amount_of_entries; i++)
    			{
    				WORD type = IMAGE_GET_BASE_RELOC_TYPE(entries[i]);
    				WORD offset = IMAGE_GET_BASE_RELOC_OFFSET(entries[i]);
    
    				if (type == IMAGE_REL_BASED_DIR64)
    				{
    					uintptr_t* path_at = reinterpret_cast<uintptr_t*>(base + reloc_begin->VirtualAddress + offset);
    					*path_at += location_delta;
    				}
    			}
    			reloc_begin = reinterpret_cast<PIMAGE_BASE_RELOCATION>(reinterpret_cast<std::byte*>(reloc_begin) + reloc_begin->SizeOfBlock);
    		}
    	}
    
    	auto import_dir = opt_header->DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT];
    
    	if (import_dir.Size)
    	{
    		auto import_desc = reinterpret_cast<PIMAGE_IMPORT_DESCRIPTOR>(base + import_dir.VirtualAddress);
    
    		while (import_desc->Name)
    		{
    			auto module_name = reinterpret_cast<char*>(base + import_desc->Name);
    			HMODULE module = load_library(module_name);
    
    			if (!module)
    			{
    				map->status = LOAD_LIBRARY_FAILED;
    				return -2;
    			}
    
    			auto INT_TABLE = reinterpret_cast<PIMAGE_THUNK_DATA>(base + (import_desc->OriginalFirstThunk ? import_desc->OriginalFirstThunk : import_desc->FirstThunk));
    			auto IAT_TABLE = reinterpret_cast<PIMAGE_THUNK_DATA>(base + (import_desc->FirstThunk));
    
    			for (; INT_TABLE->u1.AddressOfData ; INT_TABLE++, IAT_TABLE++)
    			{
    				FARPROC address = IMAGE_SNAP_BY_ORDINAL(INT_TABLE->u1.Ordinal) ? 
    					get_proc_address(module, reinterpret_cast<char*>(IMAGE_ORDINAL(INT_TABLE->u1.Ordinal))) :
    					get_proc_address(module, reinterpret_cast<PIMAGE_IMPORT_BY_NAME>(base + INT_TABLE->u1.AddressOfData)->Name);
    
    				if (!address)
    				{
    					map->status = GET_PROC_ADDRESS_FAILED;
    					return -3;
    				}
    
    				IAT_TABLE->u1.Function = reinterpret_cast<uintptr_t>(address);
    			}
    			++import_desc;
    		}
    	}
    
    	auto delay_dir = opt_header->DataDirectory[IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT];
    
    	if (delay_dir.Size)
    	{
    		auto delay_desc = reinterpret_cast<PIMAGE_DELAYLOAD_DESCRIPTOR>(base + delay_dir.VirtualAddress);
    
    		while (delay_desc->DllNameRVA)
    		{

    0xDEADBEEF, 09 Мая 2026

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

    0

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    public function getResource(): ResourceInterface
    {
        $locale = $this->localeRepository->getByKey($this->getCurrentLocaleKey());
    
        return new Resource($locale->getKey());
    }

    tre, 29 Апреля 2026

    Комментарии (4)
  11. Haskell / Говнокод #29225

    0

    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
    # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
    # This Source Code Form is subject to the terms of the Mozilla Public
    # License, v. 2.0. If a copy of the MPL was not distributed with this
    # file, You can obtain one at http://mozilla.org/MPL/2.0/.
    
    if CONFIG['OS_ARCH'] == 'WINNT':
        DIRS += ['win']
    elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
        DIRS += ['mac']
    elif CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'gtk3'):
        DIRS += ['unix']
    else:
        DIRS += ['emacs']

    2 часа пытался понять, почему ctrl+a работает как в терминале...
    Это мёртвый код или пасхалка?

    mittorn, 27 Января 2026

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