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

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

    +173

    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
    //Функция возвращает номер месяца по названию
    	  function month_to_num ($month) {
          if (mb_strtolower($month,"UTF-8") == mb_strtolower($this->t("январь"),"UTF-8") || mb_strtolower($month,"UTF-8") == mb_strtolower($this->t("января"),"UTF-8")) {$num = 1;}
          if (mb_strtolower($month,"UTF-8") == mb_strtolower($this->t("февраль"),"UTF-8") || mb_strtolower($month,"UTF-8") == mb_strtolower($this->t("февраля"),"UTF-8")) {$num = 2;}
          if (mb_strtolower($month,"UTF-8") == mb_strtolower($this->t("март"),"UTF-8") || mb_strtolower($month,"UTF-8") == mb_strtolower($this->t("марта"),"UTF-8")) {$num = 3;}
          if (mb_strtolower($month,"UTF-8") == mb_strtolower($this->t("апрель"),"UTF-8") || mb_strtolower($month,"UTF-8") == mb_strtolower($this->t("апреля"),"UTF-8")) {$num = 4;}
          if (mb_strtolower($month,"UTF-8") == mb_strtolower($this->t("май"),"UTF-8") || mb_strtolower($month,"UTF-8") == mb_strtolower($this->t("мая"),"UTF-8")) {$num = 5;}
          if (mb_strtolower($month,"UTF-8") == mb_strtolower($this->t("июнь"),"UTF-8") || mb_strtolower($month,"UTF-8") == mb_strtolower($this->t("июня"),"UTF-8")) {$num = 6;}
          if (mb_strtolower($month,"UTF-8") == mb_strtolower($this->t("июль"),"UTF-8") || mb_strtolower($month,"UTF-8") == mb_strtolower($this->t("июля"),"UTF-8")) {$num = 7;}
          if (mb_strtolower($month,"UTF-8") == mb_strtolower($this->t("август"),"UTF-8") || mb_strtolower($month,"UTF-8") == mb_strtolower($this->t("августа"),"UTF-8")) {$num = 8;}
          if (mb_strtolower($month,"UTF-8") == mb_strtolower($this->t("сентябрь"),"UTF-8") || mb_strtolower($month,"UTF-8") == mb_strtolower($this->t("сентября"),"UTF-8")) {$num = 9;}
          if (mb_strtolower($month,"UTF-8") == mb_strtolower($this->t("октябрь"),"UTF-8") || mb_strtolower($month,"UTF-8") == mb_strtolower($this->t("октября"),"UTF-8")) {$num = 10;}
          if (mb_strtolower($month,"UTF-8") == mb_strtolower($this->t("ноябрь"),"UTF-8") || mb_strtolower($month,"UTF-8") == mb_strtolower($this->t("ноября"),"UTF-8")) {$num = 11;}
          if (mb_strtolower($month,"UTF-8") == mb_strtolower($this->t("декабрь"),"UTF-8") || mb_strtolower($month,"UTF-8") == mb_strtolower($this->t("декабря"),"UTF-8")) {$num = 12;}
    				  return $month;
    	  }

    vaska_proger, 01 Сентября 2011

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

    +173

    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
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    83. 83
    84. 84
    85. 85
    86. 86
    87. 87
    88. 88
    89. 89
    90. 90
    91. 91
    92. 92
    93. 93
    $translation = array(
    
    	"äï" => "am",
    
    	"ïï" => "pm",
    
    	"ÄÏ" => "AM",
    
    	"ÏÏ" => "PM",
    
    	"Ïîíåäåëüíèê" => "Monday",
    
    	"ïíä" => "Mon",
    
    	"Âòîðíèê" => "Tuesday",
    
    	"âòð" => "Tue",
    
    	"Ñðåäà" => "Wednesday",
    
    	"ñðä" => "Wed",
    
    	"×åòâåðã" => "Thursday",
    
    	"÷òâ" => "Thu",
    
    	"Ïÿòíèöà" => "Friday",
    
    	"ïòí" => "Fri",
    
    	"Ñóááîòà" => "Saturday",
    
    	"ñáò" => "Sat",
    
    	"Âîñêðåñåíüå" => "Sunday",
    
    	"âñê" => "Sun",
    
    	"ÿíâàðü" => "January",
    
    	"ÿíâ" => "Jan",
    
    	"ôåâðàëü" => "February",
    
    	"ôåâ" => "Feb",
    
    	"ìàðò" => "March",
    
    	"ìàðò" => "Mar",
    
    	"àïðåëü" => "April",
    
    	"àïð" => "Apr",
    
    	"ìàÿ" => "May",
    
    	"Ìàé" => "May",
    
    	"èþíü" => "June",
    
    	"èþí" => "Jun",
    
    	"èþëü" => "July",
    
    	"èþë" => "Jul",
    
    	"àâãóñò" => "August",
    
    	"àâã" => "Aug",
    
    	"ñåíòÿáðü" => "September",
    
    	"ñåí" => "Sep",
    
    	"îêòÿáðü" => "October",
    
    	"Oct" => "îêò",
    
    	"íîÿáðü" => "November",
    
    	"íîÿ" => "Nov",
    
    	"äåêàáðü" => "December",
    
    	"äåê" => "Dec",
    
    	"st" => "îå",
    
    	"nd" => "îå",
    
    	"rd" => "å",
    
    	"th" => "îå");

    Допиливал проект одного идиота...
    Решение проблем с кодировкой в лоб.

    hash, 17 Августа 2011

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

    +173

    1. 1
    define('style', '<link rel="stylesheet" type="text/css" href="/style.css">');

    такого еще не встречал... o_O

    Sulik78, 17 Августа 2011

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

    +173

    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
    function assign_rand_value($num)
    {
    	// accepts 1 - 36
    	switch($num)
    	{
    		case "1":
    			$rand_value = "a";
    			break;
    		case "2":
    			$rand_value = "b";
    			break;
    		case "3":
    			$rand_value = "c";
    			break;
    		case "4":
    			$rand_value = "d";
    			break;
    
    // Длинный толстый кусок говна вниз
    
    			case "31":
    			$rand_value = "4";
    			break;
    		case "32":
    			$rand_value = "5";
    			break;
    		case "33":
    			$rand_value = "6";
    			break;
    		case "34":
    			$rand_value = "7";
    			break;
    		case "35":
    			$rand_value = "8";
    			break;
    		case "36":
    			$rand_value = "9";
    			break;
    	}
    	return $rand_value;
    }

    пиздец. Так классно поддерживать чужой говнокод.

    warider, 18 Июля 2011

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

    +173

    1. 1
    throw (i?getMainException():int());

    Говногость, 24 Июня 2011

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

    +173

    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
    if(  ( (!empty($HTTP_COOKIE_VARS["lang"])) and ($_POST["lang"] != "") )
    or ( (empty($HTTP_COOKIE_VARS["lang"])) and ($_POST["lang"] != "") ) )
    {
    	setcookie ("lang","",time()+(60*60*24*30),"","");
    	setcookie ("lang",$_POST["lang"],time()+(60*60*24*30),"","");
    	$lang = $_POST[lang];
    }
    
    if ( (empty($HTTP_COOKIE_VARS["lang"])) and (!isset($_POST["lang"])) )
    $lang = $def_language;
    
    if ( (!empty($HTTP_COOKIE_VARS["lang"])) and (!isset($_POST["lang"])) )
    $lang = $HTTP_COOKIE_VARS["lang"];

    Самый ужасный скрипт который встречал когда либо, joker board. и автор просит за него приличную сумму денег! Там код хоть целиком сюда вставляй...

    zigzagkms, 26 Мая 2011

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

    +173

    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
    //Такую штуку можно встретить на большинстве страниц раз по 5
    $lrow = mysql_query("select title,sendn,sende,notifs,
              nmails,nmails1,nmails2,nmails3,nmails4,nmails5,nmails6,nmails7,nmails8,nmails9,nmails10,
              nmails11,nmails12,nmails13,nmails14,nmails15,nmails16,nmails17,nmails18,nmails19,nmails20,
              nmails21,nmails22,nmails23,nmails24,nmails25,nmails26,nmails27,nmails28,nmails29,nmails30,
              nmails31,nmails32,nmails33,nmails34,nmails35,nmails36,nmails37,nmails38,nmails39,nmails40,
              cont,cont1,cont2,cont3,cont4,cont5,cont6,cont7,cont8,cont9,cont10,
              cont11,cont12,cont13,cont14,cont15,cont16,cont17,cont18,cont19,cont20,
              cont21,cont22,cont23,cont24,cont25,cont26,cont27,cont28,cont29,cont30,
              cont31,cont32,cont33,cont34,cont35,cont36,cont37,cont38,cont39,cont40,
              texts,texts1,texts2,texts3,texts4,texts5,texts6,texts7,texts8,texts9,texts10,
              texts11,texts12,texts13,texts14,texts15,texts16,texts17,texts18,texts19,texts20,
              texts21,texts22,texts23,texts24,texts25,texts26,texts27,texts28,texts29,texts30,
              texts31,texts32,texts33,texts34,texts35,texts36,texts37,texts38,texts39,texts40 from $ltable where listnum = '$ulist'",$link) or die('admin-37-'.mysql_error());
      list($ltitle,$sendn,$sende,$notifs,
              $nmails,$nmails1,$nmails2,$nmails3,$nmails4,$nmails5,$nmails6,$nmails7,$nmails8,$nmails9,$nmails10,
              $nmails11,$nmails12,$nmails13,$nmails14,$nmails15,$nmails16,$nmails17,$nmails18,$nmails19,$nmails20,
              $nmails21,$nmails22,$nmails23,$nmails24,$nmails25,$nmails26,$nmails27,$nmails28,$nmails29,$nmails30,
              $nmails31,$nmails32,$nmails33,$nmails34,$nmails35,$nmails36,$nmails37,$nmails38,$nmails39,$nmails40,
              $cont,$cont1,$cont2,$cont3,$cont4,$cont5,$cont6,$cont7,$cont8,$cont9,$cont10,
              $cont11,$cont12,$cont13,$cont14,$cont15,$cont16,$cont17,$cont18,$cont19,$cont20,
              $cont21,$cont22,$cont23,$cont24,$cont25,$cont26,$cont27,$cont28,$cont29,$cont30,
              $cont31,$cont32,$cont33,$cont34,$cont35,$cont36,$cont37,$cont38,$cont39,$cont40,
              $texts,$texts1,$texts2,$texts3,$texts4,$texts5,$texts6,$texts7,$texts8,$texts9,$texts10,
              $texts11,$texts12,$texts13,$texts14,$texts15,$texts16,$texts17,$texts18,$texts19,$texts20,
              $texts21,$texts22,$texts23,$texts24,$texts25,$texts26,$texts27,$texts28,$texts29,$texts30,
              $texts31,$texts32,$texts33,$texts34,$texts35,$texts36,$texts37,$texts38,$texts39,$texts40)=mysql_fetch_row($lrow);
    
    // Это вывод строк, полученных выше
    echo "
    <br>
     <input type=text class=xbox name=tnmails1 value=\"".htmlspecialchars($nmails1)."\" size=61 style=\"width: 150px\">";
    
     $res1 = mysql_query ("SELECT subject,content FROM lm_saved");
     $myrow1 = mysql_fetch_array ($res1);
     echo "<select name=tncont1 style='width:150px'>";
     if($tncont1){
     	echo "<option selected>$tncont1</option>";
    	$rrr1 = mysql_query("SELECT content from lm_saved where subject='$tncont1'");
    	$rrrrow1 = mysql_fetch_array ($rrr1);
    	mysql_query ("UPDATE lm_lists SET texts1='$rrrrow1[content]' WHERE listnum='$list'"); }
    		else {echo "<option selected>".htmlspecialchars($cont1)."</option>";}
    		do { echo "<option value='$myrow1[subject]'>$myrow1[subject]</option>";}
    		while ($myrow1 = mysql_fetch_array ($res1));
    		echo "</select>";
    getUserFieldsList($ltable,$list, 2);
     
    // И так еще раз 39 ...

    Дали задание "добавить еще 20 полей в программе". Похоже автор сеиго не подозревал об fetch_assoc и циклах. Каждая страница этой "программы" включает в себя css + html + js. Самое обидное, что сделать как надо - потратить пару месяцев, посему приходиться делать тоже самое тупым копипастом. Впервые в жизни меня реально тошнило от правки кода.

    index0h, 17 Мая 2011

    Комментарии (24)
  9. C++ / Говнокод #6682

    +173

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    NNLayer::~NNLayer()
    {
    	// call Initialize(); makes sense if you think
    	
    	Initialize();
    }

    Отсюда: http://www.codeproject.com/KB/library/NeuralNetRecognition.aspx

    eigenein, 16 Мая 2011

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

    +173

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    echo("
    <div id='navigation'>
    	<center>
    		<ul>
    			<li><a href='http://URL' id='homelink' onmouseover=" . '"Enlarge(' ."'#homelink')" . '"'. " onmouseout='" . 'Normalize("#homelink")' . "'>Домой</a></li>
    			<li><a href='#' id='aboutlink' onmouseover=" . '"Enlarge(' ."'#aboutlink')" . '"'. " onmouseout='" . 'Normalize("#aboutlink")' . "'>О нас</a></li>
    			<li><a href='http://URL' id='bdlink' onmouseover=" . '"Enlarge(' ."'#bdlink')" . '"'. " onmouseout='" . 'Normalize("#bdlink")' . "'>База знаний</a></li>
    			<li><a href='#' id='chatlink' onmouseover=" . '"Enlarge(' ."'#chatlink')" . '"'. " onmouseout='" . 'Normalize("#chatlink")' . "'>Общение</a></li>");

    Вот так вот справляемся с двумя видами кавычек.

    RaZeR, 14 Апреля 2011

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

    +173

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    if ($mail->send($mailTo)) { 
    			$aSuccMess[] = "Спасибо. Ваш сообщение отправлено. Администрация сайта рассмотрит его в ближайшее время.";
    			$fname = $fmail = $ftext = "";
    		} else { 
    			$fname = $fmail = $ftext = "";
    			$aSuccMess[] = "Спасибо. Ваш сообщение отправлено. Администрация сайта рассмотрит его в ближайшее время.";
    		}

    Взято с сайта, сделанным моим коллегой)

    sleeper, 24 Марта 2011

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