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

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

    +164

    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
    aLength = V_Array.length;
    if(aLength == 1) { 
     if(V_Array[0][0]=='true'){
      document.MainListForm.list_DV[0].checked = true;
      document.MainListForm.list_NE[0].checked = true;
     }else{
      document.MainListForm.list_DV[0].checked = false;
      document.MainListForm.list_NE[0].checked = false;
     }
     if(V_Array[0][1]=='true'){
      document.MainListForm.list_DV[1].checked = true;
      document.MainListForm.list_NE[1].checked = true;
     }else{
      document.MainListForm.list_DV[1].checked = false;
      document.MainListForm.list_NE[1].checked = false;
     }
     if(V_Array[0][2]=='true'){
      document.MainListForm.list_DV[2].checked = true;
      document.MainListForm.list_NE[2].checked = true;
     }else{
      document.MainListForm.list_DV[2].checked = false;
      document.MainListForm.list_NE[2].checked = false;
     }
     if(V_Array[0][3]=='true'){
      document.MainListForm.list_DV[3].checked = true;
      document.MainListForm.list_NE[3].checked = true;
     }else{
      document.MainListForm.list_DV[3].checked = false;
      document.MainListForm.list_NE[3].checked = false;
     }
     return;
    }
    
    for (i = 0; i < aLength ; i++) {
     if(V_Array[i][0]=='true'){
      document.MainListForm[i].list_DV[0].checked = true;
      document.MainListForm[i].list_NE[0].checked = true;
     }else{
      document.MainListForm[i].list_DV[0].checked = false;
      document.MainListForm[i].list_NE[0].checked = false;
     }
     if(V_Array[i][1]=='true'){
      document.MainListForm[i].list_DV[1].checked = true;
      document.MainListForm[i].list_NE[1].checked = true;
     }else{
      document.MainListForm[i].list_DV[1].checked = false;
      document.MainListForm[i].list_NE[1].checked = false;
     }
     if(V_Array[i][2]=='true'){
      document.MainListForm[i].list_DV[2].checked = true;
      document.MainListForm[i].list_NE[2].checked = true;
     }else{
      document.MainListForm[i].list_DV[2].checked = false;
      document.MainListForm[i].list_NE[2].checked = false;
     }
     if(V_Array[i][3]=='true'){
      document.MainListForm[i].list_DV[3].checked = true;
      document.MainListForm[i].list_NE[3].checked = true;
     }else{
      document.MainListForm[i].list_DV[3].checked = false;
      document.MainListForm[i].list_NE[3].checked = false;
     }
    }

    типично китайский привет из реал лайф проект

    kuku, 09 Февраля 2011

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

    +165

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    if (aNew=='true'){
    	  path = './page.html?show='+ashow+'&avail='+aavail+'&page='+page+'&size='+asize+'&order='+aorder+'&ordera='+aordera+'&refresh='+arefresh+'&letter='+aletter+'&sortcount='+asortcount+'&search=off&new=true';
    }else{
    	  path = './page.html?show='+ashow+'&avail='+aavail+'&page='+page+'&size='+asize+'&order='+aorder+'&ordera='+aordera+'&refresh='+arefresh+'&letter='+aletter+'&sortcount='+asortcount+'&search=off&new=false';
    }

    разница в &new=true/false
    Код из большого серьезного продакшен проекта.

    kuku, 09 Февраля 2011

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

    +162

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    <?php
        function is_get($id) {
            return (count(array_unique(str_split($id))) == 1);
        }
    ?>

    Гет или не гет?)

    hidespb, 09 Февраля 2011

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

    +146

    1. 1
    2. 2
    <div id="minobfl-page">
    										<div id="minobfl-page-content"><div style="margin: 10px 5px 5px;"><table style="border-bottom: 2px solid rgb(204, 204, 204);" align="center" border="0" cellpadding="4"><tbody><tr><td align="center"><div id="rg-map"><!--End Preload Script--><!--ImageReady Slices(r-v4_final.psd)--><table id="Table_01" border="0" cellpadding="0" cellspacing="0" height="323" width="600"><tbody><tr><td colspan="2"><img name="r_01" src="images/rmap/r_01.gif" alt="" usemap="#r_01_Map" border="0" height="84" width="81"></td><td colspan="3"><img id="r_02" src="images/rmap/r_02.gif" alt="" usemap="#r_02_Map" border="0" height="84" width="81"></td><td colspan="2"><img id="r_03" src="images/rmap/r_03.gif" alt="" usemap="#r_03_Map" border="0" height="84" width="81"></td><td><img id="r_04" src="images/rmap/r_04.gif" alt="" height="84" width="81"></td><td><img id="r_05" src="images/rmap/r_05.gif" alt="" height="84" width="81"></td><td><img id="r_06" src="images/rmap/r_06.gif" alt="" usemap="#r_06_Map" border="0" height="84" width="81"></td><td><img id="r_07" src="images/rmap/r_07.gif" alt="" usemap="#r_07_Map" border="0" height="84" width="114"></td></tr><tr><td rowspan="2"><img src="images/rmap/r_08.gif" alt="" height="85" width="47"></td><td><img id="r_09" src="images/rmap/r_09.gif" alt="" usemap="#r_09_Map" border="0" height="45" width="34"></td><td><img id="r_10" src="images/rmap/r_10.gif" alt="" usemap="#r_10_Map" border="0" height="45" width="34"></td><td><img id="r_11" src="images/rmap/r_11.gif" alt="" usemap="#r_11_Map" border="0" height="45" width="34"></td><td colspan="2"><img id="r_12" src="images/rmap/r_12.gif" alt="" usemap="#r_12_Map" border="0" height="45" width="34"></td><td rowspan="2"><img id="r_13" src="images/rmap/r_13.gif" alt="" usemap="#r_13_Map" border="0" height="85" width="60"></td><td rowspan="2"><img

    Не очень говнокод, но ЖИСТОКЕ HTML+JS. Исходный код страницы портала для военнослужащих (http://dom.mil.ru/). Это - только 1/20, если не меньше. Сколько обезьян они наняли столько печатать?

    RaZeR, 09 Февраля 2011

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

    +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
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    var DatePicker = function () {
      ...
      return {
        init: function(options) {...},
        showPicker: function() {...},
        hidePicker: function() {...},
        setDate: function(date, shiftTo) {...},
        getDate: function(formated) {...},
        clear: function() {...},
        fixLayout: function() {...}
      };
    }();
    $.fn.extend({
      DatePicker: DatePicker.init,
      DatePickerHide: DatePicker.hidePicker,
      DatePickerShow: DatePicker.showPicker,
      DatePickerSetDate: DatePicker.setDate,
      DatePickerGetDate: DatePicker.getDate,
      DatePickerClear: DatePicker.clear,
      DatePickerLayout: DatePicker.fixLayout
    });

    Взято с http://www.eyecon.ro/datepicker/

    wmmorgun, 08 Февраля 2011

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

    +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
    if ($arResult["CurrentStep"] == 1)
    	include($_SERVER["DOCUMENT_ROOT"].$templateFolder."/step1.php");
    elseif ($arResult["CurrentStep"] == 2)
    	include($_SERVER["DOCUMENT_ROOT"].$templateFolder."/step2.php");
    elseif ($arResult["CurrentStep"] == 3)
    	include($_SERVER["DOCUMENT_ROOT"].$templateFolder."/step3.php");
    elseif ($arResult["CurrentStep"] == 4)
    	include($_SERVER["DOCUMENT_ROOT"].$templateFolder."/step4.php");
    elseif ($arResult["CurrentStep"] == 5)
    	include($_SERVER["DOCUMENT_ROOT"].$templateFolder."/step5.php");
    elseif ($arResult["CurrentStep"] >= 6)
    	include($_SERVER["DOCUMENT_ROOT"].$templateFolder."/step6.php");

    Из проекта на битриксе.

    hdkeeper, 08 Февраля 2011

    Комментарии (4)
  8. Java / Говнокод #5566

    +146

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    protected void displayBoard() {
        for (int i = 0; i < this.viewArea.getComponentCount(); i++) {
          Component next = this.viewArea.getComponent(i);
          next.paint(next.getGraphics());
        }
        try {
          Thread.currentThread();
          Thread.sleep(50);
        } catch (Exception e) {
        }
      }

    странный код. Особенно не понял строку 7

    Lure Of Chaos, 07 Февраля 2011

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

    +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
    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
    p0=0;
    p1=0;
    inn=0;
    out=0;
    nx=0;ny=0;wh=0;wy=0;
    
    function rand(min, max)
    {
      return Math.random() * (max - min) + min;
    }
    
    function in_fld() {
    	rere();
    }
    
    function rere() {
    	var ctx = document.getElementById('field').getContext('2d');
    	var fimg = new Image();
    	fimg.onload = function(){
    		ctx.drawImage(fimg,0,0);
    		ctx.stroke();
    	}
    	fimg.src = 'images/field.png';
    	var bimg = new Image();
    	bimg.onload = function(){
    		ctx.drawImage(bimg,ps,n_y(),g_h()/2,g_h());
    		ctx.stroke();
    	}
    	bimg.src = 'images/b_b.png';
    	ps+=30;
    	if (ps>=gmx()) {
    		l+=1;
    		if (l>3) l=1;
    		ps=n_x();
    		if (l==3) {
    			shoots = Array(0,0,0,0,0,0,0,0,0,0);
    			used=Array(0,0,0,0,0);
    			sht((lap-1)%2,0);
    			shooting(0,0);
    			document.getElementById('field').addEventListener('mousemove', field_mm, false);
    			document.getElementById('field').addEventListener('mousedown', field_md, false);
    			stop=-1;
    		}
    	}
    	if (stop==1) setTimeout('rere()',40);
    }
    
    function n_x() {
    	switch (l) {
    		case 1:
    			return 15;
    			break;
    		case 2:
    			return 15;
    			break;
    		case 3:
    			return 200;
    	}
    }
    
    function n_y() {
    	switch (l) {
    		case 1:
    			return 350;
    			break;
    		case 2:
    			return 490;
    			break;
    		case 3:
    			return 590;
    	}
    }

    qbasic, 06 Февраля 2011

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

    +156

    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
    <? include($DOCUMENT_ROOT."/admin/login.php");
       include($DOCUMENT_ROOT."/rus/config.php");
       $sql=@mysql_connect($sql_addr,$sql_login,$sql_pass);
       mysql_select_db($sql_dbname);
       //news read
       $query="select name from ".$pre."_manufacturer where pid=\"".$pid."\";";
       $result=mysql_query($query);
       $row=mysql_fetch_array($result);
       $manuf=$row[0];
       $query="select id,src,name,value from ".$pre."_catalogue where pid=\"".$pid."\";";
       $result=mysql_query($query);
       $count=mysql_num_rows($result);
       for ($i=0;$i<$count;$i++)
       {
        $row=mysql_fetch_array($result);
        $id   [$i]=$row[0];
        $src  [$i]=$row[1];
        $name [$i]=$row[2];
        $value[$i]=$row[3];
        }
    ?>
    <... тут был кусок HTML'я ...>
    <? for ($i=0;$i<$count;$i++)
    {
        echo "<tr bgcolor=\"#FFFFFF\"><form action=\"save_item.php?id=".$id[$i]."\" method=\"post\"><td valign=\"top\"><div align=\"right\"><b>".$name[$i]."</b><br><img src=\"/rus/pics/".$src[$i]."\"><br><input type=\"text\" size=\"20\" name=\"src\" value=\"".$src[$i]."\"></div>\n";
        echo "</td><td><div align=\"left\"><textarea name=\"value\" rows=\"8\" cols=\"70\" wrap=\"VIRTUAL\">".$value[$i]."</textarea><input type=\"hidden\" name=\"pid\" value=\"".$pid."\"><input type=\"hidden\" name=\"title\" value=\"".$title."\">\n";
        echo "<br><input type=\"submit\" name=\"submit\" value=\"Исправить\"><input type=\"submit\" name=\"submit\" value=\"Удалить\"></div></td></form></tr>\n";
     }?>
    <... тут был еще один кусок HTML'я ...>
    <? mysql_close();?>

    Нашел всего один свой старый проект, вот что наковырял. Написано в марте 2004го.

    wmmorgun, 05 Февраля 2011

    Комментарии (4)
  11. C# / Говнокод #5502

    +128

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    public class TDebug
    	{
    		public static void Assert(bool condition)
    		{
    			System.Diagnostics.Debug.Assert(condition);
    #if DEBUG
    			if(!condition)
    				throw new Exception();
    #endif
    		}
    	}

    Говногость, 03 Февраля 2011

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