1. C# / Говнокод #4156

    +145

    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
    public double FindMax(double num1, double num2, double num3)
        {
            double max = num1;
            if (num2 > max)
            {
                max = num2;
            }
            if (num3 > max)
            {
                max = num3;
            }
            return max;
        }

    KamaZz, 02 Сентября 2010

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

    +116

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    if ($shops_select!="") {$_SESSION['shops_select'] = $shops_select;} $shops_select = $_SESSION['shops_select'];
    if ($city!="") {$_SESSION['city'] = $city;} $city = $_SESSION['city'];
    if ($num!="") {$_SESSION['num'] = $num;} $num = $_SESSION['num'];
    $array_note = $_SESSION['array_note'];
    $array_cat2 = $_SESSION['array_cat2'];

    Кусочек магазина больше показать не могу. но и этого хватит чтоб понять что это за отборное говнецо. З.Ы. я 3 минуты сидел и не мог понять что надо курить чтобы так писать

    Vasiliy, 02 Сентября 2010

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

    +165

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    if ( p->m_p ) 
    {
          m_p = p->m_p;
    }
    else 
    {
          m_p = NULL;
    }

    Мля, ну а вдруг

    J0hnny, 02 Сентября 2010

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

    +159

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    /**
    	     	 * Устанавливаем настройки соединения, по хорошему этого здесь не должно быть :)
    	     	 * считайте это костылём
    	     	 */
            	$oDbSimple->query("set character_set_client='utf8'");
            	$oDbSimple->query("set character_set_results='utf8'");
            	$oDbSimple->query("set collation_connection='utf8_bin'");

    Зато честно =) Взято из LiveStreet, файл Database.class.php

    hybroid, 02 Сентября 2010

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

    +116

    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
    private void ProcessMessages()
    {
    	if (!string.IsNullOrEmpty(Request.QueryString["m"]))
    	{
    		string mes = string.Empty;
    		switch (Request.QueryString["m"])
    		{
    			case "2":
    				mes = "Настройки были успешно сохранены.";
    				break;
    			
    			...
    			
    			case "10":
    				mes = "Изменения в получении отчётов на e-mail, были сохранены.";
    				break;
    			case "11":
    				mes = "Установлен новый основной счет.";
    				break;
    			case "12":
    				mes = "Счёт был успешно отключен.";
    				break;
    		}
    
    		webMessage.Text = HtmlUtils.PrintBreak(mes);
    	}
    }

    Enum?

    asilmacc, 01 Сентября 2010

    Комментарии (19)
  6. PHP / Говнокод #4150

    +172

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    $i = 1;
    while ($ip = mysql_fetch_array($result))
    {
    	$ip_end = explode(".", $ip[0]);
    	
    	if ($ip_end[3] != $i && $i < 245 && $i != 100)
    	{
    		$ip_pub = "{$mask}.$i";
    		$i = 246;
    	}
    	$i++;
    }

    Буквально на неделю отлучился, а один товарищ накрапал такую конструкцию

    Werdn, 01 Сентября 2010

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

    +161

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    function actionId(child) {
    	return child.action[{
    		'menu': 'ivrMenuId',
    		'queu': 'queueId',
    		'scenario': 'scenarioId'
    	}[child.action.type.toLowerCase()]];
    }

    Те,кто будет это поддерживать, недостойны моего сострадания!

    ixth, 01 Сентября 2010

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

    +173

    1. 1
    2. 2
    3. 3
    for ($i = 1; $i <= 1; $i++) {
        echo $top_stats;
    }

    Найден в одном из популярных дополнений для vbulletin.
    На вопрос - "Зачем for ($i = 1; $i <= 1; $i++)", получил ответ - "А ты подставь 5 заместо второй единицы, увидишь как всё криво станет"

    hcy321, 01 Сентября 2010

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

    −856

    1. 1
    SELECT i.*, p.link as p_link, p.title as p_title, p.p_id FROM `items` i, `places` p WHERE i.public='1' and i.place=p.id and  (i.place='1' or i.place='1972' or i.place='2' or i.place='3' or i.place='4' or i.place='5' or i.place='6' or i.place='7' or i.place='8' or i.place='9' or i.place='10' or i.place='11' or i.place='12' or i.place='13' or i.place='14' or i.place='15' or i.place='16' or i.place='17' or i.place='18' or i.place='19' or i.place='20' or i.place='21' or i.place='22' or i.place='23' or i.place='24' or i.place='25' or i.place='26' or i.place='27' or i.place='28' or i.place='29' or i.place='30' or i.place='31' or i.place='32' or i.place='33' or i.place='34' or i.place='35' or i.place='36' or i.place='37' or i.place='38' or i.place='39' or i.place='40' or i.place='41' or i.place='42' or i.place='43' or i.place='44' or i.place='45' or i.place='46' or i.place='47' or i.place='48' or i.place='49' or i.place='50' or i.place='51' or i.place='52' or i.place='53' or i.place='54' or i.place='55' or i.place='56' or i.place='57' or i.place='58' or i.place='59' or i.place='60' or i.place='61' or i.place='62' or i.place='63' or i.place='64' or i.place='65' or i.place='66' or i.place='67' or i.place='68' or i.place='69' or i.place='70' or i.place='71' or i.place='72' or i.place='73' or i.place='74' or i.place='75' or i.place='76' or i.place='77' or i.place='78' or i.place='79' or i.place='80' or i.place='81' or i.place='82' or i.place='83' or i.place='84' or i.place='85' or i.place='86' or i.place='87' or i.place='88' or i.place='89' or i.place='90' or i.place='91' or i.place='92' or i.place='93' or i.place='94' or i.place='95' or i.place='96' or i.place='97' or i.place='98' or i.place='99' or i.place='100' or i.place='101' or i.place='102' or i.place='103' or i.place='104' or i.place='105' or i.place='106' or i.place='107' or i.place='108' or i.place='109' or i.place='110' or i.place='111' or i.place='112' or i.place='113' or i.place='114' or i.place='115' or i.place='116' or i.place='117' or i.place='118' or i.place='119' or i.place='120' or i.place='121' or i.place='122' or i.place='123' or i.place='124' or i.place='125' or i.place='126' or i.place='127' or i.place='128' or i.place='129' or i.place='130' or i.place='131' or i.place='132' or i.place='133' or i.place='134' or i.place='135' or i.place='136' or i.place='137' or i.place='138' or i.place='139' or i.place='140' or i.place='141' or i.place='142' or i.place='143' or i.place='144' or i.place='145' or i.place='146' or i.place='147' or i.place='148' or i.place='149' or i.place='150' or i.place='151' or i.place='152' or i.place='153' or i.place='154' or i.place='155' or i.place='156' or i.place='157' or i.place='158' or i.place='159' or i.place='160' or i.place='161' or i.place='162' or i.place='163' or i.place='164' or i.place='165' or i.place='166')  ORDER BY i.lastupdated DESC LIMIT 18160, 10;

    есть ещё примерно такой же, но с JOINами

    wiz, 01 Сентября 2010

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

    +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
    <?php
    if(date("D") == "Mon"){
        if(date("G")<13){ 
            echo "Мы предполагаем, что ваш заказ будет доставлен во вторник.";
        }else{ 
            echo "Мы предполагаем, что ваш заказ будет доставлен в среду.";
        }
    }elseif(date("D") == "Tue"){
        if(date("G")<13){ 
            echo "Мы предполагаем, что ваш заказ будет доставлен в среду.";
        }else{ 
            echo "Мы предполагаем, что ваш заказ будет доставлен во четверг.";
        }
    }elseif(date("D") == "Wed"){
        if(date("G")<13){ 
            echo "Мы предполагаем, что ваш заказ будет доставлен в четверг.";
        }else{ 
            echo "Мы предполагаем, что ваш заказ будет доставлен в пятницу.";
        }
    }elseif(date("D") == "Thu"){
        if(date("G")<13){
            echo "Мы предполагаем, что ваш заказ будет доставлен в пятницу.";
        }else{ 
            echo "Мы предполагаем, что ваш заказ будет доставлен в субботу.";
        }
    }elseif(date("D") == "Fri"){
        if(date("G")<13){ 
            echo "Мы предполагаем, что ваш заказ будет доставлен в субботу.";
        }else{ 
            echo "Мы предполагаем, что ваш заказ будет доставлен в среду.";
        }
    }else{
        echo "К сожалению, склад интернет-магазина работает только в будние дни, поэтому ваш заказ может быть доставлен во вторник.";
    }
    ?>

    ChillyBwoy, 01 Сентября 2010

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