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

    +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
    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
    <div class="form-group">
    	<label for="inputName" class="col-sm-2 control-label">День рождения:</label>
    	<div class="col-sm-3">
    		<select class="form-control" id="day">
    			<option <?php if($explode[2] == 01) Echo "selected"; ?> value="01">01</option>
    			<option <?php if($explode[2] == 02) Echo "selected"; ?> value="02">02</option>
    			<option <?php if($explode[2] == 03) Echo "selected"; ?> value="03">03</option>
    			<option <?php if($explode[2] == 04) Echo "selected"; ?> value="04">04</option>
    			<option <?php if($explode[2] == 05) Echo "selected"; ?> value="05">05</option>
    			<option <?php if($explode[2] == 06) Echo "selected"; ?> value="06">06</option>
    			<option <?php if($explode[2] == 07) Echo "selected"; ?> value="07">07</option>
    			<option <?php if($explode[2] == 08) Echo "selected"; ?> value="08">08</option>
    			<option <?php if($explode[2] == 09) Echo "selected"; ?> value="09">09</option>
    			<option <?php if($explode[2] == 10) Echo "selected"; ?> value="10">10</option>
    			<option <?php if($explode[2] == 11) Echo "selected"; ?> value="11">11</option>
    			<option <?php if($explode[2] == 12) Echo "selected"; ?> value="12">12</option>
    			<option <?php if($explode[2] == 13) Echo "selected"; ?> value="13">13</option>
    			<option <?php if($explode[2] == 14) Echo "selected"; ?> value="14">14</option>
    			<option <?php if($explode[2] == 15) Echo "selected"; ?> value="15">15</option>
    			<option <?php if($explode[2] == 16) Echo "selected"; ?> value="16">16</option>
    			<option <?php if($explode[2] == 17) Echo "selected"; ?> value="17">17</option>
    			<option <?php if($explode[2] == 18) Echo "selected"; ?> value="18">18</option>
    			<option <?php if($explode[2] == 19) Echo "selected"; ?> value="19">19</option>
    			<option <?php if($explode[2] == 20) Echo "selected"; ?> value="20">20</option>
    			<option <?php if($explode[2] == 21) Echo "selected"; ?> value="21">21</option>
    			<option <?php if($explode[2] == 22) Echo "selected"; ?> value="22">22</option>
    			<option <?php if($explode[2] == 23) Echo "selected"; ?> value="23">23</option>
    			<option <?php if($explode[2] == 24) Echo "selected"; ?> value="24">24</option>
    			<option <?php if($explode[2] == 25) Echo "selected"; ?> value="25">25</option>
    			<option <?php if($explode[2] == 26) Echo "selected"; ?> value="26">26</option>
    			<option <?php if($explode[2] == 27) Echo "selected"; ?> value="27">27</option>
    			<option <?php if($explode[2] == 28) Echo "selected"; ?> value="28">28</option>
    			<option <?php if($explode[2] == 29) Echo "selected"; ?> value="29">29</option>
    			<option <?php if($explode[2] == 30) Echo "selected"; ?> value="30">30</option>
    			<option <?php if($explode[2] == 31) Echo "selected"; ?> value="31">31</option>
    		</select>
    	</div>
    	<div class="col-sm-4">
    		<select class="form-control" id="month">
    			<option <?php if($explode[3] == 01) Echo "selected"; ?> value="01">Января</option>
    			<option <?php if($explode[3] == 02) Echo "selected"; ?> value="02">Февраля</option>
    			<option <?php if($explode[3] == 03) Echo "selected"; ?> value="03">Марта</option>
    			<option <?php if($explode[3] == 04) Echo "selected"; ?> value="04">Апреля</option>
    			<option <?php if($explode[3] == 05) Echo "selected"; ?> value="05">Мая</option>
    			<option <?php if($explode[3] == 06) Echo "selected"; ?> value="06">Июня</option>
    			<option <?php if($explode[3] == 07) Echo "selected"; ?> value="07">Июля</option>
    			<option <?php if($explode[3] == 08) Echo "selected"; ?> value="08">Августа</option>
    			<option <?php if($explode[3] == 09) Echo "selected"; ?> value="09">Сентября</option>
    			<option <?php if($explode[3] == 10) Echo "selected"; ?> value="10">Октября</option>
    			<option <?php if($explode[3] == 11) Echo "selected"; ?> value="11">Ноября</option>
    			<option <?php if($explode[3] == 12) Echo "selected"; ?> value="12">Декабря</option>
    		</select>
    	</div>
    </div>

    Суровые челябинские программисты :)

    by133312, 13 Марта 2016

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

    +3

    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
    FOREACHINLIST(CBrushMip, bm_lnInBrush, penbr->GetBrush()->br_lhBrushMips, itbm)
      {
        CBrushMip &brmip=*itbm;
        FOREACHINDYNAMICARRAY(itbm->bm_abscSectors, CBrushSector, itbsc)
        {
          CBrushSector &bsc=*itbsc;
          FOREACHINSTATICARRAY(itbsc->bsc_abpoPolygons, CBrushPolygon, itbpo)
          {
            CBrushPolygon &bpo=*itbpo;
            CheckOnePolygon(bsc, bpo);
          }
        }
      }

    И такое используется во всём SeriousEngine

    mittorn, 13 Марта 2016

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

    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
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    objNewFile.WriteLine "	if (!table.nodeType) table = document.getElementById(table)"
    objNewFile.WriteLine "	var ctx = {worksheet: name || 'Worksheet', table: table.innerHTML}"
    objNewFile.WriteLine "	window.location.href = uri + base64(format(template, ctx))"
    objNewFile.WriteLine "}"
    objNewFile.WriteLine "})()"
    objNewFile.WriteLine "</script>"
    objNewFile.WriteLine "<input type=""button"" onclick=""tableToExcel('table1', 'Export data')"" value=""Export data to Excel"">"
    	
    objNewFile.WriteLine "<table id=""table1"" BORDER=""1"" width=""100%"">" 
    objNewFile.WriteLine "<tr><th width=""2%"">id</th><th>Computer</th><th>AV Name</th><th>AV Status</th><th>AV Bases</th><th>Host Status</th></tr>"
    
    for each comp in comps 
    	compid = compid + 1 
    		
    	Set WshShell = WScript.CreateObject("WScript.Shell")
    	Ping = WshShell.Run("ping -n 1 " & comp, 0, True)
    	Select Case Ping
    	Case 0
    		On Error Resume next 
    		Set oWMI = GetObject("winmgmts:\\" & comp & "\root\SecurityCenter2") 
    		On Error Resume next 
    		Set colAVItems = oWMI.ExecQuery("Select * from AntiVirusProduct") 
    		If colAVItems.count = 0 Then 
    			objNewFile.WriteLine "<tr><th>" & compid & "</th><th>" & comp & "</th><th><font color=""red"">No AntiViruses found</font></th><th><font color=""red"">Disabled</font></th><th><font color=""red"">NOT Up to Date</font></th><th><font color=""green"">Online</font></th></tr>"

    И это висит на главной Волан-де-сайта!

    gost, 12 Марта 2016

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

    +6

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    void MultMatrix(const GLfloat m1[16], const GLfloat m2[16], GLfloat result[16])
    {
      glLoadMatrixf(m1);
      glMultMatrixf(m2);
      glGetFloatv(GL_MODELVIEW_MATRIX, result);
    }

    LispGovno, 12 Марта 2016

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

    +5

    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
    catch(...)
    {
    	static int i = 0;                     
    	//if we enter this catch clause more than 1 time
    	//it is very likely that the RestartSystem() command
    	//did not succeed. If this is the case we just exit.
    	if(i>0)
    		exit(0);
    	else
    		MonitorT::GetInstance()->RestartSystem();
    	i++;
    	throw;
    }

    Навеяло...

    blackhearted, 11 Марта 2016

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

    +6

    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
    //		implicit_cast< >
    // I believe this was originally going to be in the C++ standard but 
    // was left out by accident. It's even milder than static_cast.
    // I use it instead of static_cast<> to emphasize that I'm not doing
    // anything nasty. 
    // Usage is identical to static_cast<>
    template <class OutputClass, class InputClass>
    inline OutputClass implicit_cast(InputClass input){
    	return input;
    }
    
    //		horrible_cast< >
    // This is truly evil. It completely subverts C++'s type system, allowing you 
    // to cast from any class to any other class. Technically, using a union 
    // to perform the cast is undefined behaviour (even in C). But we can see if
    // it is OK by checking that the union is the same size as each of its members.
    // horrible_cast<> should only be used for compiler-specific workarounds. 
    // Usage is identical to reinterpret_cast<>.
    
    // This union is declared outside the horrible_cast because BCC 5.5.1
    // can't inline a function with a nested class, and gives a warning.
    template <class OutputClass, class InputClass>
    union horrible_union{
    	OutputClass out;
    	InputClass in;
    };
    
    template <class OutputClass, class InputClass>
    inline OutputClass horrible_cast(const InputClass input){
    	horrible_union<OutputClass, InputClass> u;
    	// Cause a compile-time error if in, out and u are not the same size.
    	// If the compile fails here, it means the compiler has peculiar
    	// unions which would prevent the cast from working.
    	typedef int ERROR_CantUseHorrible_cast[sizeof(InputClass)==sizeof(u) 
    		&& sizeof(InputClass)==sizeof(OutputClass) ? 1 : -1];
    	u.in = input;
    	return u.out;
    }

    Боль и страдание шаблонного программирования на С++98. Комменты и названия доставляют.

    gorthauer87, 11 Марта 2016

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

    +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
    $res2=CSaleBasket::GetList(array(), array(
    	"PRODUCT_ID"=>$record["PRODUCT_ID"],
    	"!ORDER_ID"=>0
    ));
    $reserverY = array("N", "A", "C", "B", "D", "P", "R", "S", "T", "E");
    while($record2=$res2->GetNext()){
    
    	$ordNext = CSaleOrder::GetList(array(), array("ID"=>$record2['ORDER_ID']))->GetNext();
    
    	if(in_array($ordNext['STATUS_ID'], $reserverY) && $ordNext['CANCELED'] != 'Y')
    	{
    		$product["QUANTITY_RESERVED"] += $record2['QUANTITY'];
    	}
    }

    turbosnail, 11 Марта 2016

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

    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
    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
    void checklock(globalMemManager *c)
    	{
    		if (!c->isThread) return;
    		_voidint idl=c->isThread();
    #ifdef THREADDEBUG
    		assert(idl!=0);
    #endif
    		while (idl==0 && c->lock());
    		if (idl!=0) while (true) {
    			while (c->lockId()!=idl) {
    				c->canLeave()=idl;
    			}
    			if (c->lock()) break;
    		}
    		c->lock()=true;
    	}
    
    	void unlock(globalMemManager *c)
    	{
    		if (!c->isThread) return;
    		c->lock()=false;
    #ifdef THREADDEBUG
    		assert(c->lockId()==c->isThread());
    #endif
    		c->canLeave()=0;
    		c->lockId()=0;
    	}
    
    
    	void globalMemManager::manage()
    	{
    		if (!lock()) if (lockId()==0 && canLeave()!=0) {
    			if (!lock()) lock()=true;
    			lockId()=canLeave();
    		}
    	}

    Лучшее

    foxes, 10 Марта 2016

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

    −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
    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
    namespace bt {
    #define MEMNULL \
    	_FORCEINLINE void* operator new(size_t) { return 0; } \
    	_FORCEINLINE void operator delete(void* ) { }
    
    #define MEMDEFAULT(classname) \
    	_FORCEINLINE void* operator new(size_t size) { return extFunctions.CreateMem((unsigned int)size, 0); } \
    	_FORCEINLINE void operator delete(void* val) { extFunctions.DeleteMem(val, 0); }
    
    #define MEMMANAGER(classname) \
    	_FORCEINLINE void* operator new(size_t size) { return bt::internalmemmanager.getNew((unsigned int)size); } \
    	_FORCEINLINE void operator delete(void* val) {bt::internalmemmanager.freeThis(val,sizeof(classname));}
    
    #define MEMMANAGERCLEAN(classname) \
    	_FORCEINLINE void* operator new(size_t size) { return bt::internalmemmanager.getNewClean((unsigned int)size); } \
    	_FORCEINLINE void operator delete(void* val) { bt::internalmemmanager.freeThis(val,sizeof(classname)); }
    
    	class memManagerExport {
    	public:
    		MEMDEFAULT(memManagerExport)
    
    		BT_API memManagerExport(unsigned int size);
    
    		BT_API virtual ~memManagerExport();
    
    		/// destroy all memory segments and free list of free pointers
    		BT_API void _free();
    		/// return pointer to new object and create new segment of objects if need.
    		BT_API void *_addAlloc();
    		/// return pointer to free object
    		BT_API void *_getFree(unsigned int size);
    		/// add pointer to list of free
    		BT_API void _appendToFree(_voidint idat);
    		/// mark pointer to free ???
    		BT_API void _markFree(void* val);
    		/// return number object in segment
    		BT_API unsigned int _valid(unsigned int id);
    		/// return segment number
    		BT_API unsigned int _segid(unsigned int id);
    		/// prepare calculation for object size
    		BT_API void _calcsize(unsigned int size);
    
    	private:
    		enum States {
    			VALIDED = 0x011F1C01,
    			FREE = 0
    		};
    
    		unsigned int fisVal;
    		struct p_smemManager *fargs;
    	};
    
    	class memManager: public memManagerExport {
    	public:
    		MEMDEFAULT(memManager)
    
    		_FORCEINLINE memManager(unsigned int size):memManagerExport(size) {}
    
    		_FORCEINLINE ~memManager() {}
    
    		/// create memory for object
    		_FORCEINLINE void *getNew(unsigned int size) {return (void*)_getFree(size);}
    		/// delete memory for object
    		_FORCEINLINE void freeThis(void * val) {_appendToFree((_voidint)val);}
    		/// destroy all memory segments and free list of free
    		_FORCEINLINE void free() {_free();};
    	};
    
    	class globalMemManager {
    	public:
    		MEMDEFAULT(globalMemManager)
    
    }

    Давайте ржать

    foxes, 10 Марта 2016

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

    +7

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    private bool trap = false;
    public bool TrapExceptions
    {
    	get { return this.trap; }
    	set { this.trap = true; }
    }

    Выхода нет.

    yamamoto, 10 Марта 2016

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