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

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

    +142.3

    1. 001
    2. 002
    3. 003
    4. 004
    5. 005
    6. 006
    7. 007
    8. 008
    9. 009
    10. 010
    11. 011
    12. 012
    13. 013
    14. 014
    15. 015
    16. 016
    17. 017
    18. 018
    19. 019
    20. 020
    21. 021
    22. 022
    23. 023
    24. 024
    25. 025
    26. 026
    27. 027
    28. 028
    29. 029
    30. 030
    31. 031
    32. 032
    33. 033
    34. 034
    35. 035
    36. 036
    37. 037
    38. 038
    39. 039
    40. 040
    41. 041
    42. 042
    43. 043
    44. 044
    45. 045
    46. 046
    47. 047
    48. 048
    49. 049
    50. 050
    51. 051
    52. 052
    53. 053
    54. 054
    55. 055
    56. 056
    57. 057
    58. 058
    59. 059
    60. 060
    61. 061
    62. 062
    63. 063
    64. 064
    65. 065
    66. 066
    67. 067
    68. 068
    69. 069
    70. 070
    71. 071
    72. 072
    73. 073
    74. 074
    75. 075
    76. 076
    77. 077
    78. 078
    79. 079
    80. 080
    81. 081
    82. 082
    83. 083
    84. 084
    85. 085
    86. 086
    87. 087
    88. 088
    89. 089
    90. 090
    91. 091
    92. 092
    93. 093
    94. 094
    95. 095
    96. 096
    97. 097
    98. 098
    99. 099
    100. 100
    $my_cgi = $_SERVER['REQUEST_METHOD'] == 'GET' ? $_GET : $_POST;
    
    	$fnumber = "";
    	$fname="";
    	$fjunction = "";
    	$fstreet = "";
    	$fintersectingstreet = "";
    	$flocality = "";
    	$fadministrative = "";
    	$fpostalcode = "";
    	$fsettlement = "";
    	$flatitude = 0.0;
    	$flongitude = 0.0;
    	$fcoordtype = "";
    	$ffreetext = "";
    	$fuid = "";
    	$fsettlement = "";
    	$tnumber = "";
    	$tname="";
    	$tjunction = "";
    	$tstreet = "";
    	$tintersectingstreet = "";
    	$tstreet = "";
    	$tlocality = "";
    	$tadministrative = "";
    	$tpostalcode = "";
    	$tsettlement = "";
    	$tlatitude = 0.0;
    	$tlongitude = 0.0;
    	$tcoordtype = "";
    	$tfreetext = "";
    	$tuid = "";
    	$method = "";
    	$passenger = "";
    	$return = "";
    	$trainf = "";
    	$traind = "";
    	$flocate = "";
    	$tlocate = "";
    
    	/*****************************************************************************
    	 * Decode URL
    	 ****************************************************************************/
    	while (list($my_key, $my_value) = each($my_cgi)) {
    		if($my_key == "fname") {
    			$fname = $my_value;
    		} else if ($my_key == "fnumber" ) {
    			$fnumber = $my_value;
    		} else if($my_key == "fstreet") {
    			$fstreet = $my_value;
    		} else if($my_key == "fintersectingstreet") {
    			$fintersectingstreet = $my_value;
    		} else if($my_key == "flocality") {
    			$flocality = $my_value;
    		} else if($my_key == "fadministrative") {
    			$fadministrative = $my_value;
    		} else if ($my_key == "fpostalcode") {
    			if ($my_key["fpostalcode"] != "") {
    			$fpostalcode = $my_value;
    			}
    		} else if ($my_key == "fsettlement" ) {
    			$fsettlement = $my_value;
    		} else if ($my_key == "flatitude" ) {
    			$flatitude = $my_value;
    		} else if ($my_key == "flongitude" ) {
    			$flongitude = $my_value;
    		} else if ($my_key == "fcoordtype" ) {
    			$fcoordtype = $my_value;
    		} else if ($my_key == "fmatch_uid" ) {
    			$fuid = $my_value;
    		} else if ($my_key == "ffreetext" ) {
    			$ffreetext = $my_value;
    		} else if($my_key == "tname") {
    			$tname = $my_value;
    		} else if ($my_key == "tnumber" ) {
    			$tnumber = $my_value;
    		} else if($my_key == "tstreet") {
    			$tstreet = $my_value;
    		} else if($my_key == "tintersectingstreet") {
    			$tintersectingstreet = $my_value;
    		} else if($my_key == "tlocality") {
    			$tlocality = $my_value;
    		} else if($my_key == "tadministrative") {
    			$tadministrative = $my_value;
    		} else if ($my_key == "tpostalcode") {
    			if ($my_key["tpostalcode"] != "") {
    			$tpostalcode = $my_value;
    			}
    		} else if ($my_key == "tsettlement" ) {
    			$tsettlement = $my_value;
    		} else if ($my_key == "tnumber" ) {
    			$tnumber = $my_value;
    		} else if ($my_key == "tlatitude" ) {
    			$tlatitude = $my_value;
    		} else if ($my_key == "tlongitude" ) {
    			$tlongitude = $my_value;
    		} else if ($my_key == "tcoordtype" ) {
    			$tcoordtype = $my_value;
    		} else if ($my_key == "tmatch_uid" ) {
    			$tuid = $my_value;

    guest, 04 Июня 2009

    Комментарии (2)
  3. PHP / Говнокод #952

    +142.3

    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
    //------------------------------Запись в профиль ----------------------------//
    $ufile = file(BASEDIR."local/profil/$log.prof"); 
    $udata = explode(":||:",$ufile[0]);
    
    if($udata[10]>0){
    $udata[10]=0;
    $udata[14]=$ip;
    
    for ($u=0; $u<$config_userprofkey; $u++){
    $utext.=$udata[$u].':||:';}
    
    if($udata[0]!="" && $udata[1]!="" && $udata[4]!="" && $utext!=""){
    $fp=fopen(BASEDIR."local/profil/$log.prof","a+");  
    flock ($fp,LOCK_EX); 
    ftruncate ($fp,0);                                                              
    fputs($fp,$utext);
    fflush ($fp);
    flock ($fp,LOCK_UN);
    fclose($fp);  
    unset($utext);
    }}

    Из говно cms wap motor

    guest, 25 Апреля 2009

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

    +142.2

    1. 1
    2. 2
    3. 3
    4. 4
    void Session_Start(object sender, EventArgs e) 
     {
         Session["SessionID"] = Session.SessionID; //to avoid session regeneration
     }

    Вот так борются с устареванием сессии

    guest, 05 Августа 2009

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

    +142.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
    if ($ret == '')
    	{
    		$ret = "array('$day', '$date_num', '$date_month', '$image', '$temperatura_high', '$temperatura_low', '$osadky')";
    	}
    	else
    	{
    		$ret .= ", array('$day', '$date_num', '$date_month', '$image', '$temperatura_high', '$temperatura_low', '$osadky')";
    	}
    	$i++;
    }
    $ret = '$array = array('.$ret.');';
    eval($ret);

    Нашел случайно. А ведь работает то :)

    guest, 12 Июня 2009

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

    +142

    1. 1
    typedef long char wchar_t;

    qnx4.25 /usr/include/stdlib.h:
    sizeof(long char) == 2

    Xom94ok, 25 Июля 2015

    Комментарии (1)
  7. JavaScript / Говнокод #18518

    +142

    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
    <!DOCTYPE html>
    <html>
      <head>
        <title>Task №2</title>
      </head>
      <body>
      
        <script>
          var str = ''
          var obj_arr = []
          //Конструктор для создания объектов (елементов массива)
          function Obj_Create(name, age) {
    			this.name = name
    			this.age = +age
    		}
          //Наполнение массива объектами
            while(true) {
            var nArr = []
            var obj
            str = prompt('Введете имя и возраст объекта (формат - Name Age)')
    			if (str==null) {
    				alert('Спасибо за внимание :) \nДо свидания!')
    			break
    			}
            nArr = str.split(' ')
            if(nArr.length !=2 || nArr[0] == '' || isNaN(+nArr[1])) {
    			alert('Введены неверные значения')
    			continue
    			}
            obj = new Obj_Create(nArr[0], nArr[1])
            obj_arr.push(obj)
    		}
    		Array.prototype.sortUp = function () {
    			return this.slice().sort(function (a, b) {return a.age - b.age})
    			}
    		Array.prototype.sortDown = function() {
    			return this.slice().sort(function(a, b) {return b.age - a.age})
    			}
    		
    	    for (i=0;i<obj_arr.length; i++) {
    	        document.write('<strong>object №</strong>' + (i+1) + ':<br/>' + 'name: ' + obj_arr[i].name + '<br/>' + 'age :' + obj_arr[i].age + '<br/>' +'<br/>')
    			}
    	    var sorted_up = obj_arr.sortUp()
    	    var sorted_down = obj_arr.sortDown()
    		
    		document.write('</br><strong>По возрастанию:</strong><br/>')
    	    for (i=0; i<sorted_up.length; i++) {
    		    document.write(sorted_up[i].name +'(' +sorted_up[i].age + ')' + ' ')
    			}
    		
    		document.write('<br/><br/><strong>По убыванию:</strong><br/>')
    		for (i=0; i<sorted_down.length; i++) {
    		    document.write(sorted_down[i].name +'(' +sorted_down[i].age + ')' + ' ')
    			}  
        </script>
      </body>
    
    </html>

    stranger28, 24 Июля 2015

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

    +142

    1. 001
    2. 002
    3. 003
    4. 004
    5. 005
    6. 006
    7. 007
    8. 008
    9. 009
    10. 010
    11. 011
    12. 012
    13. 013
    14. 014
    15. 015
    16. 016
    17. 017
    18. 018
    19. 019
    20. 020
    21. 021
    22. 022
    23. 023
    24. 024
    25. 025
    26. 026
    27. 027
    28. 028
    29. 029
    30. 030
    31. 031
    32. 032
    33. 033
    34. 034
    35. 035
    36. 036
    37. 037
    38. 038
    39. 039
    40. 040
    41. 041
    42. 042
    43. 043
    44. 044
    45. 045
    46. 046
    47. 047
    48. 048
    49. 049
    50. 050
    51. 051
    52. 052
    53. 053
    54. 054
    55. 055
    56. 056
    57. 057
    58. 058
    59. 059
    60. 060
    61. 061
    62. 062
    63. 063
    64. 064
    65. 065
    66. 066
    67. 067
    68. 068
    69. 069
    70. 070
    71. 071
    72. 072
    73. 073
    74. 074
    75. 075
    76. 076
    77. 077
    78. 078
    79. 079
    80. 080
    81. 081
    82. 082
    83. 083
    84. 084
    85. 085
    86. 086
    87. 087
    88. 088
    89. 089
    90. 090
    91. 091
    92. 092
    93. 093
    94. 094
    95. 095
    96. 096
    97. 097
    98. 098
    99. 099
    100. 100
    <?php
    public
    
    function filter()
    	{
    	$manufacturers = Manufacturers::all();
    	$products = Products::where('category', '=', Input::get('category'))->get();
    	if (Input::get('size') != 'notselected')
    		{
    		$size = Input::get('size');
    		}
    
    	if (Input::get('category') == 3)
    		{
    		if (Input::get('type') != 'notselected')
    			{
    			$products = Products::where('category', '=', Input::get('category'))->where('type', '=', Input::get('type'))->get();
    			}
    		}
    
    	if (Input::get('manufacturer') != "notselected")
    		{
    		$products = Products::where('category', '=', Input::get('category'))->where('manufacturer', '=', Input::get('manufacturer'))->get();
    		}
    
    	if (Input::get('min') != 0 and Input::get('max') != 0)
    		{
    		$products = Products::where('category', '=', Input::get('category'))->whereBetween('price', array(
    			Input::get('min') ,
    			Input::get('max')
    		))->get();
    		if (Input::get('size') != "notselected")
    			{
    			$products = Products::where('category', '=', Input::get('category'))->where('size', 'LIKE', "%$size%")->whereBetween('price', array(
    				Input::get('min') ,
    				Input::get('max')
    			))->get();
    			}
    		  else
    			{
    			$products = Products::where('category', '=', Input::get('category'))->whereBetween('price', array(
    				Input::get('min') ,
    				Input::get('max')
    			))->get();
    			}
    
    		if (Input::get('manufacturer') != "notselected")
    			{
    			$products = Products::where('category', '=', Input::get('category'))->where('manufacturer', '=', Input::get('manufacturer'))->whereBetween('price', array(
    				Input::get('min') ,
    				Input::get('max')
    			))->get();
    			}
    		  else
    			{
    			$products = Products::where('category', '=', Input::get('category'))->whereBetween('price', array(
    				Input::get('min') ,
    				Input::get('max')
    			))->get();
    			}
    		}
    
    	if (Input::get('minim') != 0)
    		{
    		$products = Products::where('category', '=', Input::get('category'))->where('price', '<', Input::get('minim'))->get();
    		if (Input::get('size') != "notselected")
    			{
    			$products = Products::where('category', '=', Input::get('category'))->where('size', 'LIKE', "%$size%")->where('price', '<', Input::get('minim'))->get();
    			}
    		  else
    			{
    			$products = Products::where('category', '=', Input::get('category'))->where('price', '<', Input::get('minim'))->get();
    			}
    
    		if (Input::get('manufacturer') != "notselected")
    			{
    			$products = Products::where('category', '=', Input::get('category'))->where('manufacturer', '=', Input::get('manufacturer'))->where('price', '<', Input::get('minim'))->get();
    			}
    		  else
    			{
    			$products = Products::where('category', '=', Input::get('category'))->where('price', '<', Input::get('minim'))->get();
    			}
    		}
    
    	if (Input::get('maxim') != 0)
    		{
    		$products = Products::where('category', '=', Input::get('category'))->where('price', '>', Input::get('maxim'))->get();
    		if (Input::get('size') != "notselected")
    			{
    			$products = Products::where('category', '=', Input::get('category'))->where('size', 'LIKE', "%$size%")->where('price', '>', Input::get('maxim'))->get();
    			}
    		  else
    			{
    			$products = Products::where('category', '=', Input::get('category'))->where('price', '>', Input::get('maxim'))->get();
    			}
    
    		if (Input::get('manufacturer') != "notselected")
    			{
    			$products = Products::where('category', '=', Input::get('category'))->where('manufacturer', '=', Input::get('manufacturer'))->where('price', '>', Input::get('maxim'))->get();
    			}

    Вот так был реализован фильтр интернет-магазина. Не ну а хули?

    BlahBlag, 21 Июля 2015

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

    +142

    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
    (jQuery.noConflict()(function ($) {
      "use strict";
      $(document).on('ready', function () {
        $('.sisea-results-list').each(function () {
          var elements = $(this).find('.sisea-result'),
              size     = elements.size(),
              find     = 10;
          for (var i = 0; i < find; i++) elements.eq(i).show(300);
          $(window).on('scroll', function() {
            var scrollTop = window.pageYOffset || document.documentElement.scrollTop,
                offset    = $('#scroll').offset().top;
    
            if (scrollTop > offset - 800) {
              find < size ? find += 10 : find = size;
              for (var i = 0; i < find; i++) elements.eq(i).show(300);
            }
          });
        });
      });
    }));

    При скролле элементы появляются на странице. Говнокод ли?

    wayfarer, 21 Июля 2015

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

    +142

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    <select class="SelectStatus defaultForm_Small" id="status">
        <option value="{{ Rus['outlet'] }}" {{ Rus[Profile.State] == Rus['outlet'] ? 'selected' }}
                id="outlet"> {{ Rus['outlet'] }}</option>
        <option value="{{ Rus['leave'] }}" {{ Rus[Profile.State] == Rus['leave'] ? 'selected' }}
                id="leave"> {{ Rus['leave'] }}</option>
        <option value="{{ Rus['common'] }}" {{ Rus[Profile.State] == Rus['common'] ? 'selected' }}
                id="common"> {{ Rus['common'] }}</option>
        <option value="{{ Rus['expulsion'] }}" {{ Rus[Profile.State] == Rus['expulsion'] ? 'selected' }}
                id="expulsion"> {{ Rus['expulsion'] }}</option>
    </select>

    Нужно было вывести список с выбором и по умолчанию отображать некоторый элемент, в зависимости от State.

    xamgore, 17 Июля 2015

    Комментарии (0)
  11. JavaScript / Говнокод #18484

    +142

    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
    (function($){
        
        var popup_show_delay = 0.5; // задержка в секундах
    
        $('.in_basket').each(function(){
            var $popup = $(this).find('.flyout');
            var timeoutId = null;
    
            var showPopup = function() {
                // Показываем попап
                $popup.removeClass('hidden');
            };
    
            var hidePopup = function() {
                // Скрываем попап
                $popup.addClass('hidden');
                console.log('hide popup');
            };
    
            var $targets = $([ this, $popup.get(0) ]);
    
            $targets.on('mouseenter', function(){
                console.log('show popup');
                clearTimeout(timeoutId);
                showPopup();
            });
    
            $targets.on('mouseleave', function(){
                clearTimeout(timeoutId);
                timeoutId = setTimeout(hidePopup, popup_show_delay * 1000);
            });
        });
    
    })(jQuery);

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

    littlefuntik, 15 Июля 2015

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