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

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

    +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
    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
    program Oracle;
    
    {$APPTYPE CONSOLE}
    
    uses
      SysUtils;
    
    Var
      sQuestion : String;
      i : ShortInt;
      bAnswer : Boolean;
    Label lExit, lAnswer;
    BEGIN
     bAnswer := true;
     WriteLn('Input question: ');
     lAnswer: Read(sQuestion);
    
     If Length(sQuestion) < 4 then
      Begin
        WriteLn('What "' + sQuestion + '"?');
        Goto lAnswer;
      End;
    
    
     If sQuestion[Length(sQuestion)] <> '?' then
      Begin
        WriteLn('It`s not a question.');
        Goto lExit;
      End;
    
     Randomize;
     If Random(10) = 1 then
      Begin
        WriteLn('But why you ask?');
        Goto lExit;
      End;
    
      For i := 1 to Length(sQuestion) do
       If bAnswer = true then bAnswer := false
        Else bAnswer := false;
    
      If bAnswer = true then WriteLn('Yes.')
       Else WriteLn('No.');
    
     lExit: Readln;
    END.

    > Input question:
    > Лурк гавно?
    > No.
    > А ты всегда даешь верные ответы?
    > No.
    > В смысле?
    > What "В смысле?".
    > Ну, в прямом.
    > It`s not a question.
    > Ты будешь отвечать на мой вопрос???
    > No.
    > Тогда иди нахуй.
    > Сам иди нахуй.
    > 0_o

    Govnocoder#0xFF, 12 Апреля 2011

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

    +165

    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
    function securityMode(c_f)                                                                                                                                   
    {                                                                                                                                                            
            var security_mode;
    
            changed = c_f;
    
            hideWep();
    
            document.getElementById("div_security_shared_mode").style.visibility = "hidden";
            document.getElementById("div_security_shared_mode").style.display = "none";
            document.getElementById("div_wpa").style.visibility = "hidden";
            document.getElementById("div_wpa").style.display = "none";
            document.getElementById("div_wpa_algorithms").style.visibility = "hidden";
            document.getElementById("div_wpa_algorithms").style.display = "none";
            document.getElementById("wpa_passphrase").style.visibility = "hidden";
            document.getElementById("wpa_passphrase").style.display = "none";
            document.getElementById("wpa_key_renewal_interval").style.visibility = "hidden";
            document.getElementById("wpa_key_renewal_interval").style.display = "none";
            document.getElementById("wpa_PMK_Cache_Period").style.visibility = "hidden";
            document.getElementById("wpa_PMK_Cache_Period").style.display = "none";
            document.getElementById("wpa_preAuthentication").style.visibility = "hidden";
            document.getElementById("wpa_preAuthentication").style.display = "none";
            document.security_form.cipher[0].disabled = true;
            document.security_form.cipher[1].disabled = true;
            document.security_form.cipher[2].disabled = true;
    
            // etc...                                                                                                                                                           
    }

    Китайский говнокод, который пока даже страшно рефакторить.

    SadKo, 10 Апреля 2011

    Комментарии (15)
  4. ActionScript / Говнокод #6240

    −102

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    for (i=0; i<550; i++)
    {
           for (j<0; j<400; j++)
          {
               .....
          }
    }

    Думал почему же цикл выполняеться только 550 раз, долгое время немог понять почему XD

    maldan, 05 Апреля 2011

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

    +165

    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
    $month[1] = “Январ”;
    $month[2] = “Феврал”;
    $month[3] = “Март”;
    $month[4] = “Апрел”;
    $month[5] = “Ма”;
    $month[6] = “Июн”;
    $month[7] = “Июл”;
    $month[8] = “Август”;
    $month[9] = “Сентябр”;
    $month[10] = “Октябр”;
    $month[11] = “Декабр”;
    $month[12] = “Январ”;
    
    $day[0] = “Воскресенье”;
    $day[1] = “Понедельник”;
    $day[2] = “Вторник”;
    $day[3] = “Среда”;
    $day[4] = “Четверг”;
    $day[5] = “Пятница”;
    $day[6] = “Суббота”;
    
    $dnum = date(”w”);
    $mnum = date(”n”);
    $daym = date(”d”);
    $year = date(”Y”);
    
    $textday = $day[$dnum];
    $monthm = $month[$mnum];
    
    if ($mnum==3||$mnum==8) {
        $k=”а”;
    }
    else {
        $k=”я”;
    }
    
    echo “Сегодня: $textday, $daym $monthm$k $year г.”;

    Отсюда: http://flashripper.net/2007/10/24/delaem-vyvod-daty-na-php.html

    Anonym, 05 Апреля 2011

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

    +159

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    HMODULE nt=LoadLibrary("Ntdll.dll");
    PROCESS_BASIC_INFORMATION pbi={0};
    ZWQUERYINFORMATIONPROCESS _ZwQueryInformationProcess;
    _ZwQueryInformationProcess = (ZWQUERYINFORMATIONPROCESS)GetProcAddress(nt, "ZwQueryInformationProcess");
    DWORD rlg;
    SetLastError(0);
    _ZwQueryInformationProcess(divine,0,&pbi,sizeof(pbi),&rlg);
    printf("%d",GetLastError());

    источник: http://www.wasm.ru/forum/viewtopic.php?pid=426270#p426270

    ReL, 31 Марта 2011

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

    +170

    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
    $замены = array(
    	'{' => 'начало',
    	'}' => 'конец',
    	'for' => 'циклдля',
    	'echo' => 'вывод',
    	'print' => 'печать',
    	'while' => 'пока',
    	'foreach' => 'циклмассив',
    	'$' => 'пер ',
    	'=' => ':=',
    	//'==' => '=',
    	'!=' => '<>',
    	'function' => 'функ',
    	'true' => 'правда',
    	'false' => 'ложь',
    	'if' => 'если',
    	'else' => 'иначе',
    	'as' => 'как',
    	'array' => 'массив',
    	'_GET' => 'ГЕТ',
    	'_POST' => 'ПОСТ',
    	'return' => 'вернуть',
    );
    
    isset($_GET['debug']) ? print(ВПоХаПэ(file_get_contents($_GET['f']))) : Компилить(file_get_contents($_GET['f']));
    
    function Компилить($сорсец) {
    	eval(ВПоХаПэ($сорсец));
    }
    
    function ВПоХаПэ($сорсец) {
    	global $замены;
    	return str_replace(array_values($замены), array_keys($замены), $сорсец);
    }
    
    function ИзПоХаПэ($сорсец) {
    	global $замены;
    	return str_replace(array_keys($замены), array_values($замены), $сорсец);
    }

    Транслятор псевдоязыка в PHP

    Мартин, 30 Марта 2011

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

    +160

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    var begin_h = html.indexOf("<h1 class=\"header\">");
    var end_h = html.indexOf("</h1>");
    var data = "";
    if (begin_h != -1 && end_h != -1) {
      data = html.substr(begin_h, end_h + 5); //5 - это длина тега </h1>, чтобы его тоже захватило
    }

    Прелесть, найденная на гугл-ответах. Человек пишет расширение для Firefox.

    Vindicar, 29 Марта 2011

    Комментарии (15)
  9. JavaScript / Говнокод #5989

    +160

    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
    function antispam()
    {
    var num1=Math.floor(Math.random()*11)+1;
    var num2=Math.floor(Math.random()*11)+1;
    var sum = num1+num2;
    var userP = prompt("To check that you are not spammer, solve this simple equation - "+num1+"+"+num2+"=?","");
    if (userP != null)
    {
    if (userP != sum) 
    {
    document.write("<!--");
    alert("Wrong answer!");
    } 
    else 
    {
    document.write('<form id="logform" action="proceed.php" onsubmit="javascript:return validate("logform","email");" method="post"><p>Your name: <input type="text" name="name" /></p><p>Your password: <input type="password" name="password" /></p><p>Your e-mail: <input type="text" name="email" id="email" /></p><p><input type="submit" value="Register!" /></p></form>');
    }
    }
    }

    Вот в таком режиме работает уже месяца два. Если не ГК, прошу, посоветуйте как можно это лучше сделать (или прикрутить капчу и не парится? :)). На JS я практически не пишу, я пишу в основном под .NET.

    RaZeR, 15 Марта 2011

    Комментарии (15)
  10. Си / Говнокод #5981

    +132

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    if (argc == 3)
        snprintf(outfile, sizeof(outfile) - 1, "scan.log", argv[1], argv[2]);
    else if (argc >= 4)
    {
        snprintf(outfile, sizeof(outfile) - 1, "scan.log", argv[1], argv[3], argv[2]);
        // ...
    }

    Какой-то иксплойт, файл pscan2.c

    raorn, 14 Марта 2011

    Комментарии (15)
  11. Си / Говнокод #5965

    +135

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    //глубоко в коде
    char output[1024];
    
    //еще глубже
    struct sockaddr_in outputa;
    
    //...
    
    if(sendto(s, output, 512, 0, (struct sockaddr *) &output, rsize) == SOCKET_ERROR) {
        printf("Socket error: %i.\n", WSAGetLastError());
    }

    Долго-же я думал, почему оно вываливается с ошибкой 10047.

    danilissimus, 12 Марта 2011

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