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

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

    +137

    1. 1
    2. 2
    3. 3
    // ...
    if not Length(username) in [6..24] then
      raise Exception.Create('Длина ника должна находиться в пределах от 6 до 24 символов');

    ну прям как N ∈[6; 24]

    brainworm, 10 Января 2012

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

    +78

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    switch (blds [i])
            {
              default:
                points [0] [i] = InputGameMessage.readString ();
                break;
            }

    замечательная индусятина

    alexmelyon, 10 Января 2012

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

    +135

    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
    try {
            // ....
     } except(EXCEPTION_EXECUTE_HANDLER) {
            Err = ERROR_INVALID_PARAMETER;
            //
            // Access the following variables here so that the compiler will respect our statement
            // ordering w.r.t. these values.  Otherwise, we can't be sure that the values are accurate
            // at the point where the exception occurred.
            //
            Buffer = Buffer;
            Array = Array;
            i = i;
        }

    втф?

    mazafaker666, 10 Января 2012

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

    −87

    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
    #!/usr/bin/python
    import itertools, math, os, random, re, sys
    random.seed (1234)
    
    while True:
            s = sys.stdin.readline ().strip ()
            if s == '':
                    s = sys.stdin.readline ().strip ()
                    if s == '':
                            break
            t = sys.stdin.readline ()
            r = sys.stdin.readline ()
            s = [c for c in s]
            t = [c for c in t]
            r = [c for c in r]
            s.sort ()
            t.sort ()
            r.sort ()
            ok = True
            for c in r:
                    if len (s) > 0 and c == s[0]:
                            s = s[1:]
                    elif len (t) > 0 and c == t[0]:
                            t = t[1:]
                    else:
                            ok = False
            ok = ok and len (s) == 0 and len (t) == 0
            if ok:
                    print 'YES'
            else:
                    print 'NO'
    
    #Люди делают так:
    #a, b, c = (raw_input() for i in range(3))
    #print 'YES' if sorted(a + b) == sorted(c) else 'NO'

    Задача такая: даны три строки: a, b и c
    проверить что третья может быть получена из двух других преремешиванием

    Источник:
    codeforces, Codeforces beta 101 round, 1018183

    VisualPaul, 08 Января 2012

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

    +166

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    if ($_POST['login']!="" && $_POST['pas']!="" && $_GET['con']=='auth')
    {
        $login=$_POST['login'];
        $pas=$_POST['pas'];
        $fulld = mysql_query ("SELECT * FROM users WHERE login='$login' AND pas='$pas'",$link);
     
    ....

    Местных гурманов этим конечно не удивить. Но все же...

    nyk0r, 05 Января 2012

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

    +152

    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
    if($sedit){
    	switch ($action) {
    	case 'insert':
    		sectionInsert($structure);
    		insertMessage($_page['right_bottom'],L_MESSAGE_ADD_OK);
    		sectionInsertForm($_page['right_top'],$structure);
    		sectionList($out,$structure,$_page[FIELD_ID],$sedit);
    		$_page['bookmark_1']['content'] = L_INSERT_SECTION;
    		$_page['bookmark_1']['style'] = 'bookmark_selected';
    		$_page['bookmark_1']['url'] = URL_STRUCTURE_EDIT.'?sedit=1';
    		break;
    	case 'delete':
    		$structure->deleteBranch($_POST[FIELD_ID]);
    		insertMessage($_page['right_bottom'],L_MESSAGE_DELETE_OK);
    		sectionInsertForm($_page['right_top'],$structure);
    		sectionList($out,$structure,$_page[FIELD_ID],$sedit);
    		$_page['bookmark_1']['content'] = L_INSERT_SECTION;
    		$_page['bookmark_1']['style'] = 'bookmark';
    		$_page['bookmark_1']['url'] = URL_STRUCTURE_EDIT.'?sedit=1';
    		break;
    	case 'update':
    		sectionUpdate($structure);
    		insertMessage($_page['right_bottom'],L_MESSAGE_CHANGE_OK);
    		sectionInsertForm($_page['right_top'],$structure,$_page[FIELD_ID]);
    		sectionList($out,$structure,$_page[FIELD_ID],$sedit);
    		$_page['bookmark_1']['content'] = L_INSERT_SECTION;
    		$_page['bookmark_1']['style'] = 'bookmark';
    		$_page['bookmark_1']['url'] = URL_STRUCTURE_EDIT.'?sedit=1';
    		break;
    	case 'add_form':
    		sectionInsertForm($_page['right_top'],$structure);
    		sectionList($out,$structure,$_page[FIELD_ID],$sedit);
    		$_page['bookmark_1']['content'] = L_INSERT_SECTION;
    		$_page['bookmark_1']['style'] = 'bookmark_selected';
    		$_page['bookmark_1']['url'] = URL_STRUCTURE_EDIT.'?sedit=1';
    		break;
    	default:
    		sectionInsertForm($_page['right_top'],$structure,$_page[FIELD_ID]);
    		sectionList($out,$structure,$_page[FIELD_ID],$sedit);
    		$_page['bookmark_1']['content'] = L_INSERT_SECTION;
    		$_page['bookmark_1']['style'] = 'bookmark';
    		$_page['bookmark_1']['url'] = URL_STRUCTURE_EDIT.'?sedit=1';
    		break;
    	}
    } else{//режим редактора контента
    	switch ($action) {
    	case 'insert':
    		break;
    	case 'delete':
    		break;
    	case 'edit':
    		break;
    	case 'move':
    		break;
    	case 'update':
    		break;
    	default:
    		sectionList($out,$structure,$_page[FIELD_ID]);
    		break;
    	}
    }

    Из одной самопальной цмс.

    kyzi007, 04 Января 2012

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

    +171

    1. 1
    $link = mysql_connect("$DBSERVER", "$DBUSER", "$DBPASS","$DB_COLLATE");

    Гениально

    LiteError, 17 Декабря 2011

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

    +159

    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
    <?php
    $lst=array();
    $ip_list="http://netelis.hmsite.net/loc.txt";
    $list_ip = file_get_contents($ip_list);
    if($list_ip==FALSE){ printf("Can't open file<br>\n");exit(1);}
    preg_match_all("|(?:[1-9][0-9]{0,2})\.(?:\d{1,3})\.(?:\d{1,3})\.(?:\d{1,3})|",$list_ip,$ipl);
    $i=0;
    foreach($ipl[0] as $address){
            $lst[$i++]=$address;
            $lst[$i-1].="<br />";
    }
    $lst=array_unique($lst);
    printf("Max element %d<br>\n",sizeof($lst));
    $slst=natsort($lst);
    print_r($lst);
    ?>

    Извлекает список IP-адресов, сортирует и удаляет повторяющиеся

    AliceGoth, 17 Декабря 2011

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

    +166

    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
    /*** The following methods are NOT functional
    	        They're just there to detect coding errors at compilation time ***/
    	    inline KgeRGBAVector operator + (const KgeRGBAVector &/*pVector*/) const {KgeRGBAVector lNullVector; return lNullVector;}
            inline KgeRGBAVector operator - (const KgeRGBAVector &/*pVector*/) const {KgeRGBAVector lNullVector; return lNullVector;}
            inline KgeRGBAVector operator * (const KgeRGBAVector &/*pVector*/) const {KgeRGBAVector lNullVector; return lNullVector;}
            inline double  operator ^ (const KgeRGBAVector &/*pVector*/) const {return 0.0;}
            inline KgeRGBAVector &operator += (const KgeRGBAVector &/*pVector*/) {return *this;}
            inline KgeRGBAVector &operator -= (const KgeRGBAVector &/*pVector*/) {return *this;}
            inline KgeRGBAVector &operator *= (const KgeRGBAVector &/*pVector*/) {return *this;}
    
            inline KgeRGBAVector operator * (double /*pScalar*/) const {KgeRGBAVector lNullVector; return lNullVector;}
            inline KgeRGBAVector operator / (double /*pScalar*/) const {KgeRGBAVector lNullVector; return lNullVector;}
            inline KgeRGBAVector &operator *= (double /*pScalar*/) {return *this;}
            inline KgeRGBAVector &operator /= (double /*pScalar*/) {return *this;}

    Говнокод или гениально? Дискас.

    makc3d, 17 Декабря 2011

    Комментарии (9)
  11. ActionScript / Говнокод #8813

    −126

    1. 1
    2. 2
    3. 3
    4. 4
    Config.createErrorSkin = function (data:*):IPlayerSkin
    {
    	return new PlayerSkinPromoDjVideoErrorLoadConfState(stage.stageWidth, stage.stageHeight, data);
    }

    kyzi007, 13 Декабря 2011

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