1. C# / Говнокод #9820

    +118

    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
    protected  override bool    GetGridDT           (out object Dt)
            {
                DataTable   vDt     =   null;
                bool        vResult =   fComposition != 0 ?
                                        Composition.RN.Load(fComposition, out vDt) :
                                        fNType != 0 ?
                                        RN.Load((RNType.RNTypes)fNType, out vDt) :
                                        fRvObjectType != 0 ?
                                        RvObjectType.RN.Load(fRvObjectType, out vDt) :
                                        fRv != 0 ?
                                        Rv.RN.Load(fRv, out vDt) :
                                        fProtocol != 0 ?
                                        Protocol.RN.Load(fProtocol, out vDt) :
                                        RN.Load(out vDt);
                            Dt      =   vDt;
                return      vResult;
            }

    Ну что тут скажешь...)

    gcoder, 30 Марта 2012

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

    +126

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    public string RMV(string content, string charr)
                {
                    int X = content.IndexOf(charr);
                    if (X < 1) ;
                    else content = content.Remove(X);
                    content = content.TrimEnd();
                    return content;
                }

    Всё внимание на ветвление =)

    kefirnot, 30 Марта 2012

    Комментарии (2)
  3. JavaScript / Говнокод #9818

    +158

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    var url="/registration/reg.php?file_photo="+src_img+"&reg_email="+
    reg_email+"&last_name="+last_name+"&name="+encodeURIComponent(name)+
    "&reg_phone="+encodeURIComponent(reg_phone)+"&group_user="+group_user;
    				$('#ajax_result').load(url, function(response, status, xhr) {
    					document.location.href="success.php";
    				});

    Вот такая милая регистрация пользователя. Только вот группа пользователя указывается в запросе и не проверяется на стороне сервера.
    В результате можно зарегистрироваться администратором сайта, подставив не столь уж неизвестный id группы администраторов в параметр group_user

    twsdwf, 30 Марта 2012

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

    +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
    if (
            (_methodName == "invoke") ||
            (_methodName == "auth") ||
            (_methodName == "resetAuth") ||
            (_methodName == "registerMethod") ||
            (_methodName == "registerAllMethods")
           )
        {
           throw "Illegal method name " +_methodName +" - service method with this name already exist";
        }
        else
        {
            eval("ComponentClient.prototype."+_methodName+" = function (_parameters) {return this.invoke(\""+_methodName+"\", _parameters)}")
        }

    И там много ещё такого

    konsoletyper, 30 Марта 2012

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

    −117

    1. 1
    2. 2
    CGSize size = [[CCDirector sharedDirector] winSize];
    [[DeviceManager sharedManager] SetIpad:(size.height > 500)];

    Незнаете как определить iPad ли у вас?
    А человек знает:

    mrWindMak3r, 30 Марта 2012

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

    −89

    1. 1
    columns = [col for col in self.load_column_data()['columns']]

    Вот так мы копируем списки.

    zealotous, 30 Марта 2012

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

    +161

    1. 1
    wp_list_categories('orderby=order&hide_empty=0&title_li&echo=0&exclude=13,14,19,20,21,36,37,42,43,44,45,46,47,48,70,126,127,167,75,128,129,130,131,132,133,53,68,69,134,135,136,117,118,119,168,146,120,121,122,67,150,123,142,124,54,125,149,66,104,105,144,106,107,108,55,109,110,111,112,57,113,114,115,116,162,175,95,96,97,98,99,100,59,163,49,101,145,102,103,158,153,157,174,169,160,147,148,151,172,152,161,154,165,173,170,171,177,166,176,155,159,156,164,87,180,181,182,183,184,185,186,191,193,22,194,78,16,82,89,88,28,83,73,85,71,72,30,23,58,86,90,26,25,190,41,34,35,39,40,50,51,52,56,74,62,91,92,93,94,178,187,188,192,18,31,33,63,61,65,60,64,29,32,79,80,81');

    Как вы заебали..

    varg242, 30 Марта 2012

    Комментарии (10)
  8. Python / Говнокод #9813

    −90

    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
    def runRidor():
    	isDirty = 0
    	#Except (DebugSize <= 14) and (ImageVersion <= 760) and (VirtualSize2 > 992) and (ExportSize <= 80.5) => isDirty = 1  (1702.0/16.0) [855.0/5.0]
    	if input.DebugSize <= 14 and input.ImageVersion <= 760 and input.VirtualSize2 > 992 and input.ExportSize <= 80.5:
    		isDirty = 1
    #Except (DebugSize <= 14) and (ImageVersion <= 4525) and (ExportSize <= 198.5) and (ResourceSize <= 37532) and (VirtualSize2 <= 6) and (ResourceSize <= 7348) and (ResourceSize > 1773) => isDirty = 1  (106.0/0.0) [48.0/0.0]
    	elif input.DebugSize <= 14 and input.ImageVersion <= 4525  and input.ExportSize <= 198.5 and input.ResourceSize <= 7348 and input.VirtualSize2 <=6 and input.ResourceSize > 1773:
    		isDirty = 1
    #Except (DebugSize <= 14) and (ImageVersion <= 4950) and (ExportSize <= 192) and (IatRVA > 256) and (VirtualSize2 > 42) and (ExportSize <= 56) and (NumberOfSections > 3.5) => isDirty = 1  (193.0/0.0) [91.0/0.0]
    	elif input.DebugSize <= 14 and input.ImageVersion <= 4950 and input.ExportSize <= 56 and input.IatRVA > 256 and input.VirtualSize2 > 42 and input.NumberOfSections > 3.5:
    		isDirty = 1
    #Except (DebugSize <= 14) and (ImageVersion <= 4950) and (VirtualSize2 <= 6) and (ResourceSize <= 37532) and (ResourceSize <= 17302) => isDirty = 1  (388.0/0.0) [216.0/7.0]
    	elif input.DebugSize <= 14 and input.ImageVersion <= 4950 and input.VirtualSize2 <= 6 and input.ResourceSize > 17302:
    		isDirty = 1
    #Except (DebugSize <= 14) and (NumberOfSections > 2.5) and (ResourceSize > 1776) and (IatRVA <= 6144) and (ExportSize <= 219.5) and (VirtualSize2 > 2410) and (VirtualSize2 <= 61224) => isDirty = 1  (238.0/0.0) [116.0/0.0]
    	elif input.DebugSize <= 14 and input.NumberOfSections >= 2.5 and input.ResourceSize <= 1776 and input.IatRVA <= 6144 and input.ExportSize <= 219.5 and input.VirtualSize2 > 2410 and input.VirtualSize2 <= 61224:
    		isDirty = 1

    Пример того, как не надо писать на питоне, показывает Adobe. Полная версия: http://voxel.dl.sourceforge.net/project/malclassifier.adobe/AdobeMalwareClassifier.py

    SvartalF, 30 Марта 2012

    Комментарии (4)
  9. Pascal / Говнокод #9812

    +94

    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
    var
       one, two, free, four:string;
    begin
       one:=sLabel14.Caption+slabel14.caption;
       two:=sLabel1.Caption+slabel15.caption;
       free:=sLabel10.Caption+slabel16.caption;
       four:=sLabel7.Caption+slabel17.caption;
    
       if ((one = two) or (one = free) or (one = four)
       or (two = one) or (two = free) or (two = four)
       or (free = one) or (free = two) or (free = four)
       or (four = one) or (four = two) or (four = free))
       then begin
           showmessage('Значения должны быть различными');
       end
       else begin
           showmessage('Успешно сохранено');
       end;

    Ну не лол?

    penkovsky1, 29 Марта 2012

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

    +153

    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
    require_once('adodb/adodb.inc.php');
    
    class adoDbConnector
    {
        private static $instance = null;
    	
        public static function getInstance()
        {
    	if (self::$instance == NULL)
    	{
    		self::$instance = new adoDbConnector();
    	}
    		
    	return self::$instance;
        }
    
        private function __construct() { }
    	
        public function __clone()
        {
            trigger_error('No __clone()!', E_USER_ERROR);
        }
    
        public function __wakeup()
        {
            trigger_error('No __wakeup()!', E_USER_ERROR);
    	}
    	
    	public function connect($connectionType, $connectionData)
    	{
    		switch($connectionType)
    		{
                        case 0: 
    			return self::generalConnect($connectionData);
    			break;
    			
                        case 1: 
    			return self::dsnConnect($connectionData);
    			break;
    				
                        case 2: 
    			return self::xmlConnect($connectionData);
    			break;
    				
                        default:
    			throw new Exception('Wrong type of connection!');
    		}
    	}
    	
    	private static function generalConnect($connectionData)
    	{	
    		if(is_array($connectionData))
    		{
    			$conn = &ADONewConnection($connectionData[0]); 
    				
    			$conn->PConnect($connectionData[1], $connectionData[2], 
                                    $connectionData[3], $connectionData[4]);
    				
    			return $conn;
    		}
    		else throw new Exception('Wrong type of connection data, must be an array!');
    	}
    	
    	private static function dsnConnect($connectionData)
    	{		
    		if(is_string($connectionData))
    		{
    			$conn = ADONewConnection($connectionData);
    				
    			return $conn;
    		}
    		else throw new Exception('Wrong type of connection data, must be a string!');
    	}
    	
    	private static function xmlConnect($connectionData)
    	{
    		if(is_string($connectionData) && file_exists($connectionData))
    		{
    			$xml = simplexml_load_file($connectionData);
    			
    			foreach($xml as $x)
    			{
    				$connArr[] = trim($x);
    			}
    			
    			$conn = &ADONewConnection($connArr[0]);
    			
    			$conn->PConnect($connArr[1], $connArr[2], $connArr[3], $connArr[4]);
    				
    			return $conn;
    		}
    		else throw new Exception('Wrong file name or connection type!');
    	}
    		
    }

    Archont12, 29 Марта 2012

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