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

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

    +156

    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 mpeval($file_name, $arg = array(), $vr = 1){
    	global $conf;
    	foreach(explode(':', $conf['fs']['path'], 2) as $k=>$v)
    		if (file_exists($file = "$v/$file_name")) break;
    	if (!file_exists($file = "$v/$file_name")) return "<div style=\"margin-top:100px; text-align:center;\"><span style=color:red;>Ошибка доступа к файлу</span> $v/$file_name</div>";
    
    	ob_start();
    	eval('?>'. strtr(file_get_contents($file), array('<? die;'=>'<?', '<?php die;'=>'<?php')));
    	$content = ob_get_contents();
    	ob_end_clean();
    	return $content;
    }

    eval`им вовсю

    nkarakin, 09 Июня 2013

    Комментарии (1)
  3. Си / Говнокод #13115

    +135

    1. 1
    #define __click_window_chkarmor (!((inventory==plr->inventory)&&(((slot==5)&&!hasflag(consts.item_flags[plr->holdingitem->type],ITEM_FLAG_ARMOR_HEAD))||((slot==6)&&!hasflag(consts.item_flags[plr->holdingitem->type],ITEM_FLAG_ARMOR_CHEST))||((slot==7)&&!hasflag(consts.item_flags[plr->holdingitem->type],ITEM_FLAG_ARMOR_FEET))||((slot==8)&&!hasflag(consts.item_flags[plr->holdingitem->type],ITEM_FLAG_ARMOR_BOOTS)))))

    Форматирование сохранено

    kostoprav, 05 Июня 2013

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

    −161

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    CREATE TABLE blah (
      ...
      status ENUM('1', '2', '3') NOT NULL COMMENT "Статус модерации",
      ...
    );

    Модерация на раз-два-три.

    scriptin, 03 Июня 2013

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

    +149

    1. 1
    $years = range(date('Y', $now), date('Y', strtotime('+ 1 year', $now)));

    Пятница в моей голове... А надо было всеголтшь действующий и следующий

    nonamez, 24 Мая 2013

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

    +147

    1. 1
    <cbimport_import_check_checkimport>

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

    vesan, 21 Мая 2013

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

    +156

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    // Если больше 23:30, то сверяем мультиреестровые
            if (mktime(date('H'), date('i'), date('s'), date('m'), date('d'), date('Y')) >= mktime(23, 30, 0, date('m'), date('d'), date('Y')) || $notime == 1)
                $sql .= ' AND pi.multiregistry = "1"';
            else
                $sql .= ' AND pi.multiregistry = "0"';

    Колдуем даты

    dimkich, 17 Мая 2013

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

    +127

    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
    //top edge
                if (normal)
                    for (int i = y; i > 0; i--)
                        if (_map[x, i] == 0)
                            if ((i - 1) > minDist) { mnt.Corners[0] = new Point(x, i - 1 + minDist); break; }
                            else { normal = false; mnt.Height = -1; }
    
                //top-right edge
                if (normal)
                    for (int i = 0; ((x + i) < MAP_SIZE) & ((y - i) > 0); i++)
                        if (_map[x + i, y - i] == 0)
                            if (Math.Sqrt(2) * (MAP_SIZE - i) > minDist) { mnt.Corners[1] = new Point(x + i - 1 - minDist, y - i + 1 + minDist); break; }
                            else { normal = false; mnt.Height = -1; }
    
                //right edge
                if (normal)
                    for (int i = x; i < MAP_SIZE; i++)
                        if (_map[i, y] == 0)
                            if ((MAP_SIZE - i - 1) > minDist) { mnt.Corners[2] = new Point(i - 1 - minDist, y); break; }
                            else { normal = false; mnt.Height = -1; }
    
                //bottom-right edge
                if (normal)
                    for (int i = 0; ((x + i) < MAP_SIZE) & ((y + i) < MAP_SIZE); i++)
                        if (_map[x + i, y + i] == 0)
                            if (Math.Sqrt(2) * (MAP_SIZE - i) > minDist) { mnt.Corners[3] = new Point(x + i - 1 - minDist, y + i - 1 - minDist); break; }
                            else { normal = false; mnt.Height = -1; }
    
                //bottom edge
                if (normal)
                    for (int i = y; i > 0; i++)
                        if (_map[x, i] == 0)
                            if ((i - 1) > minDist) { mnt.Corners[4] = new Point(x, i - 1 - minDist); break; }
                            else { normal = false; mnt.Height = -1; }
    
                //bottom-left edge
                if (normal)
                    for (int i = 0; ((x - i) < MAP_SIZE) & ((y + i) > 0); i++)
                        if (_map[x - i, y + i] == 0)
                            if (Math.Sqrt(2) * (MAP_SIZE - i) > minDist) { mnt.Corners[5] = new Point(x - i + 1 + minDist, y + i - 1 - minDist); break; }
                            else { normal = false; mnt.Height = -1; }
    
                //left edge
                if (normal)
                    for (int i = x; i > 0; i--)
                        if (_map[i, y] == 0)
                            if ((i + 1) > minDist) { mnt.Corners[6] = new Point(i + 1 + minDist, y); break; }
                            else { normal = false; mnt.Height = -1; }
    
                //top-left edge
                if (normal)
                    for (int i = 0; ((x - i) > 0) & ((y - i) > 0); i++)
                        if (_map[x - i, y - i] == 0)
                            if (Math.Sqrt(2) * (MAP_SIZE - i) > minDist) { mnt.Corners[7] = new Point(x - i + 1 + minDist, y - i + 1 + minDist); break; }
                            else { normal = false; mnt.Height = -1; }

    Мне было лень думать. Очень лень.

    RaZeR, 11 Мая 2013

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

    +102

    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 (
         !(this.Department.Length == 4 && 
                "0123456789".Contains(this.Department[0]) && 
                "0123456789".Contains(this.Department[1]) && 
                "0123456789".Contains(this.Department[2]) && 
                "0123456789".Contains(this.Department[3])) &&
         !(this.Department.Length == 4 && 
                "0123456789".Contains(this.Department[0]) && 
                "ABCDEFGHIJKLMNOPQRSTUVWXYZ".Contains(this.Department[1]) && 
                "ABCDEFGHIJKLMNOPQRSTUVWXYZ".Contains(this.Department[2]) && 
                "ABCDEFGHIJKLMNOPQRSTUVWXYZ".Contains(this.Department[3])) &&
         !(this.Department.Length == 5 && 
                "0123456789".Contains(this.Department[0]) && 
                "0123456789".Contains(this.Department[4]) && 
                "ABCDEFGHIJKLMNOPQRSTUVWXYZ".Contains(this.Department[1]) && 
                "ABCDEFGHIJKLMNOPQRSTUVWXYZ".Contains(this.Department[2]) && 
                "ABCDEFGHIJKLMNOPQRSTUVWXYZ".Contains(this.Department[3])))
         {
          return "error";
         }

    Он видимо не знал о существовании регулярных выражений

    NeoN, 02 Мая 2013

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

    +8

    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
    ....
    #define MAX_PROC_LIST 1024
    enum PROCCESS_TYPE
    {
    	 OFFRO,
             GFEER,
             OLLYD,
    	 FLOOT,
              SFOIT,
    };
    
    typedef struct 
    {
    	PROCCESS_TYPE tType;
    	unsigned short uPid;
    	bool bIA32;
    }ACTIVE_PROCCESS_INFO, *PACTIVE_PROCCESS_INFO;
    ....
    
    bool MONITOR_PROCCESS_ENGINE::GetActiveProccessInfo(PACTIVE_PROCCESS_INFO pActiveInfoProccess, const unsigned int nIndex)
    {
    	if(nIndex < 0) return false;
    	PROCESSENTRY32 pe32;
    	HANDLE hProcessSnap = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 );
    	bool bFound = false;
    	pe32.dwSize = sizeof( PROCESSENTRY32 );
    	if(!Process32First( hProcessSnap, &pe32 )) return false;
    	char szNameImage[MAX_PATH];
    	ZeroMemory(szNameImage, MAX_PATH);
    	do 
    	{
    		if(pe32.th32ProcessID == aProccessList[nIndex])
    		{
    			bFound = true;
    		        wcstombs(szNameImage, (const wchar_t *)pe32.szExeFile, wcslen(pe32.szExeFile));
    			break;
    		}
    
    	} while( Process32Next( hProcessSnap, &pe32 ));
    	CloseHandle(hProcessSnap);
    
    	if(bFound && strlen(szNameImage)) 
            {
    		  if(!strcmp(szNameImage, szActiveList32[0])) 
    			  pActiveInfoProccess->tType = OFFRO;
    		  else
    		  if(!strcmp(szNameImage, szActiveList32[1])) 
    			   pActiveInfoProccess->tType = GFEER;
    		  else
    		  if(!strcmp(szNameImage, szActiveList32[2]))
    			  pActiveInfoProccess->tType =  OLLYD;
    		  else 
    		  if(!strcmp(szNameImage, szActiveList32[3]))
    			  pActiveInfoProccess->tType =  FLOOT;
    		  else 
    		  if(!strcmp(szNameImage, szActiveList32[4]))
    			  pActiveInfoProccess->tType =  SFOIT;
    		  else  return false;
    		 pActiveInfoProccess->uPid = (unsigned short) aProccessList[nIndex];
    		 pActiveInfoProccess->bIA32 = true; // Fixme x64?
    	}
    	else return false;
    	return true;
    }

    Cи в стиле C++

    not123, 09 Апреля 2013

    Комментарии (1)
  11. JavaScript / Говнокод #12817

    +151

    1. 1
    if (Scene.generatedFast || (typeof generatedFast != "undefined" && generatedFast) )

    Lure Of Chaos, 28 Марта 2013

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