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

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

    +168.9

    1. 1
    die('<script LANGUAGE="JavaScript">location.replace("'.$url.'");');

    Приветствуем победителя конкурса на самый извращенный редирект.

    wwwguru, 03 Марта 2010

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

    +151.2

    1. 1
    <body onload="blinkAfterSearch();setTimeout('loadDummyImg()', 590000);var ex; try { startUpTasks(); } catch(ex) {}" />

    Недавно отрыл в недрах нашего проекта! Try catch в onload!! :D

    jericho, 02 Марта 2010

    Комментарии (16)
  4. PHP / Говнокод #2685

    +171

    1. 1
    $class = (preg_match("/^[0-9]+$/", $i/2)) ? "cssBgGrey" : "cssBgLightBlue";

    Подсветка четных строк.

    paladin80, 27 Февраля 2010

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

    +60.9

    1. 1
    return ((Dirty = (Buff = ((uint8 *)realloc (Buff, BuffLen = new_len))) !=0));

    sagol, 26 Февраля 2010

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

    +144.8

    1. 1
    void updateEach(void *ptr, void *unused)

    chipmunk update method
    chipmunk - физический движок (типа под iPhone) на сях. Прелесть, правда?

    FIZZER, 04 Февраля 2010

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

    +169.8

    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
    if ( ( $_GET [ "lang" ] ) || ( $_POST [ "lang" ] ) )
     {
      if ( ( $_GET [ "lang" ] == "de" ) || ( $_POST [ "lang" ] == "de" ) ) { include ( "../language/german_setup.php"     ); $lang = "de"; }
      if ( ( $_GET [ "lang" ] == "en" ) || ( $_POST [ "lang" ] == "en" ) ) { include ( "../language/english_setup.php"    ); $lang = "en"; }
      if ( ( $_GET [ "lang" ] == "nl" ) || ( $_POST [ "lang" ] == "nl" ) ) { include ( "../language/dutch_setup.php"      ); $lang = "nl"; }
      if ( ( $_GET [ "lang" ] == "it" ) || ( $_POST [ "lang" ] == "it" ) ) { include ( "../language/italian_setup.php"    ); $lang = "it"; }
      if ( ( $_GET [ "lang" ] == "es" ) || ( $_POST [ "lang" ] == "es" ) ) { include ( "../language/spanish_setup.php"    ); $lang = "es"; }
      if ( ( $_GET [ "lang" ] == "fa" ) || ( $_POST [ "lang" ] == "fa" ) ) { include ( "../language/farsi_setup.php"      ); $lang = "fa"; }
      if ( ( $_GET [ "lang" ] == "dk" ) || ( $_POST [ "lang" ] == "dk" ) ) { include ( "../language/danish_setup.php"     ); $lang = "dk"; }
      if ( ( $_GET [ "lang" ] == "fr" ) || ( $_POST [ "lang" ] == "fr" ) ) { include ( "../language/french_setup.php"     ); $lang = "fr"; }
      if ( ( $_GET [ "lang" ] == "tr" ) || ( $_POST [ "lang" ] == "tr" ) ) { include ( "../language/turkish_setup.php"    ); $lang = "tr"; }
      if ( ( $_GET [ "lang" ] == "hu" ) || ( $_POST [ "lang" ] == "hu" ) ) { include ( "../language/hungarian_setup.php"  ); $lang = "hu"; }
      if ( ( $_GET [ "lang" ] == "pt" ) || ( $_POST [ "lang" ] == "pt" ) ) { include ( "../language/portuguese_setup.php" ); $lang = "pt"; }
      if ( ( $_GET [ "lang" ] == "he" ) || ( $_POST [ "lang" ] == "he" ) ) { include ( "../language/hebrew_setup.php"     ); $lang = "he"; }
     }
    else
     {
      include ( "../language/german_setup.php" );   # include language vars
      $lang = "de";
     }

    Из известного php web stat релиза 2009 в июле.
    В первом попавшимся на глаза скрипте.

    vov4ik, 02 Февраля 2010

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

    +147.7

    1. 1
    http://rmd.atdmt.com/tl/DocumentDotWrite.js

    Оригинал http://thedailywtf.com/Articles/Amazingly-Brilliant-or-Incredibly-Stupid.aspx

    HyperGeek, 02 Февраля 2010

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

    +65.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
    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
    private static String getUTF8String(byte[] b, int off, int len) {
    	// First, count the number of characters in the sequence
    	int count = 0;
    	int max = off + len;
    	int i = off;
    	while (i < max) {
    	    int c = b[i++] & 0xff;
    	    switch (c >> 4) {
    	    case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7:
    		// 0xxxxxxx
    		count++;
    		break;
    	    case 12: case 13:
    		// 110xxxxx 10xxxxxx
    		if ((int)(b[i++] & 0xc0) != 0x80) {
    		    throw new IllegalArgumentException();
    		}
    		count++;
    		break;
    	    case 14:
    		// 1110xxxx 10xxxxxx 10xxxxxx
    		if (((int)(b[i++] & 0xc0) != 0x80) ||
    		    ((int)(b[i++] & 0xc0) != 0x80)) {
    		    throw new IllegalArgumentException();
    		}
    		count++;
    		break;
    	    default:
    		// 10xxxxxx, 1111xxxx
    		throw new IllegalArgumentException();
    	    }
    	}
    	if (i != max) {
    	    throw new IllegalArgumentException();
    ....

    В либе работы с зипом

    Cdf-EaSy, 01 Февраля 2010

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

    +144.9

    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
    node_t* read_record(FILE *file) {
        int success = 0;
        node_t *record = 0;
        do {
            int nsz, dsz;
            record = (node_t*)malloc(sizeof(node_t));
            if (!record) {
                break;
            }
            record->data = 0;
            record->next = 0;
    
            if (fread(&nsz, sizeof(int), 1, file) != 1 || feof(file)) {
                break;
            }
    
            if (fread(record->name, 1, nsz, file) != nsz || feof(file)) {
                break;
            }
    
            /* ... */
    
            record->nsz = nsz;
            record->dsz = dsz;
            success = 1;
        } while (0);
    
        if (record && !success) {
            free_list(record);
            record = 0;
        }
    
        return record;
    }
    
    
    void write_record(FILE *file, node_t *record) {
        int dsz = record->dsz;
        int nsz = record->nsz;
    
        if ((fwrite(&nsz, sizeof(int), 1, file) != 1) ||
            (fwrite(record->name, 1, nsz, file) != nsz) ||
            (fwrite(&csz, sizeof(int), 1, file) != 1) ||
            (fwrite(record->data, 1, dsz, file) != dsz) ||
            ferror(file)) {
            fputs("Error: write_record", stderr);
        }
    }

    govnopetya, 26 Января 2010

    Комментарии (16)
  11. PHP / Говнокод #2478

    +162.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
    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
    $cities_id=array(1,2,3,4,5,6);
     $cities_name=array("MSK","SPB","NN","KZ","NOV","UFA");
     
     GHTML::Run(array("html_autoinsert_on"=>0,"html_method"=>"_POST"));
    
     print GHTML::Link("/test.php",null,GHTML::Link("/test.php","style='font-weight:bold;font-size:20px;'")->Html("[Главная]"))->Html("[Главная]");
     print " ";
     print GHTML::Link("/test.php?act=reg",null,GHTML::Link("/test.php?act=reg","style='font-weight:bold;font-size:20px;'")->Html("[Регистрация]"))->Html("[Регистрация]");
      
      
     print GHTML::Form("POST","")
     ->HTML(
         GHTML::Input("name","text","Имя пользователя",null,true)->Html(),
         "<br>",
         GHTML::Input("pass1","password","Пароль")->Html(),
    	 "<br>",
         GHTML::Input("pass2","password","Пароль ещё раз")->Html(),
    	 "<br>",
         GHTML::Select("city")->Html(
               GHTML::Option("")->Html("Выберите город"),
               GHTML::Option($cities_id,$_POST['city'])->Html($cities_name)
         ),
    	 "<br>",
    	 GHTML::CheckBoxList("che_cities[]",$cities_id,null,$_POST['che_cities'])->Html($cities_name),
         "<br>",
    	 GHTML::RadioList("r_cities[]",$cities_id,null,$_POST['r_cities'])->Html($cities_name),
    	 "<br>",
         GHTML::Textarea("resume",50,9,null,true)->Html("Ненмого о себе"),
    	 "<br>",	 
    	 GHTML::Input("","submit","Жми!")->Html()
     );
    
    
    //////////////////////////////////////////////////////////////////////////////////////////////////
    //////////////////////////////////////////////////////////////////////////////////////////////////
    //////////////////////////////////////////////////////////////////////////////////////////////////
    
    
    <a href='/test.php'  />[Главная]</a> <a href='/test.php?act=reg' style='font-weight:bold;font-size:20px;' />[Регистрация]</a><form method='POST' action='' /><input type='text' name='name' value='Имя пользователя'  /><br><input type='password' name='pass1' value='Пароль'  /><br><input type='password' name='pass2' value='Пароль ещё раз'  /><br><select name='city'  /><option value=''  />Выберите город</option><option value='6'  />MSK</option><option value='5'  />SPB</option><option value='4'  />NN</option><option value='3'  />KZ</option><option value='2'  />NOV</option><option value='1'  />UFA</option></select><br><input type='checkbox' name='che_cities[]' value='6'  />MSK<br /><input type='checkbox' name='che_cities[]' value='5'  />SPB<br /><input type='checkbox' name='che_cities[]' value='4'  />NN<br /><input type='checkbox' name='che_cities[]' value='3'  />KZ<br /><input type='checkbox' name='che_cities[]' value='2'  />NOV<br /><input type='checkbox' name='che_cities[]' value='1'  />UFA<br /><br><input type='radio' name='r_cities[]' value='6'  />MSK<br /><input type='radio' name='r_cities[]' value='5'  />SPB<br /><input type='radio' name='r_cities[]' value='4'  />NN<br /><input type='radio' name='r_cities[]' value='3'  />KZ<br /><input type='radio' name='r_cities[]' value='2'  />NOV<br /><input type='radio' name='r_cities[]' value='1'  />UFA<br /><br><textarea name='resume' cols='50' rows='9'  />Ненмого о себе</textarea><br><input type='submit' name='' value='Жми!'  /></form>

    хорошо что php гиппертекстовый ;)

    Mitusbka, 24 Января 2010

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