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

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

    +163.2

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    $isLoginned = true;
    
    if (strlen(strval($isLoginned)) == 4) {
    } else {
    }

    В одном из опенсурсных форумов в исходниках видел

    chipfind, 11 Августа 2009

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

    +133.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
    for (int i = 0; i < gvOrderMain.RowCount - EditIndex; i++)
                                {
                                    float tempQuantity = GetRow(i).Quantity;
                                    int partyLen = DB.PrInStOrderByPartyNum(GetRow(i).ProductId, curStockId).ToArray().Length;
                                    for (int j = 0; j < partyLen; j++)
                                    {
                                        if (DB.PrInStOrderByPartyNum(GetRow(i).ProductId, curStockId).ToArray()[j].Quantity > 0)
                                        {
                                            float CurSQuantity = DB.PrInStOrderByPartyNum(GetRow(i).ProductId, curStockId).ToArray()[j].Quantity.Value;
                                            if (tempQuantity > CurSQuantity)
                                            {
                                                Documents_Product dp = new Documents_Product();
                                                dp.PrimePriceExcVAT = DB.PrInStOrderByPartyNum(GetRow(i).ProductId, curStockId).ToArray()[j].PrimePriceExcVAT;
                                                dp.PrimePriceIncVAT = DB.PrInStOrderByPartyNum(GetRow(i).ProductId, curStockId).ToArray()[j].PrimePriceIncVAT;
                                                dp.Quantity = -1 * DB.PrInStOrderByPartyNum(GetRow(i).ProductId, curStockId).ToArray()[j].Quantity;
                                                dp.OldQuantity = DB.PrInStOrderByPartyNum(GetRow(i).ProductId, curStockId).ToArray()[j].Quantity;
                                                dp.PartyNumber = DB.PrInStOrderByPartyNum(GetRow(i).ProductId, curStockId).ToArray()[j].PartyNumber;
                                                DB.Documents_Products.InsertOnSubmit(dp);
                                                DB.SubmitChanges();
    
                                                Documents_ProductsOrder dro = new Documents_ProductsOrder();
                                                dro.PriceSum = GetRow(i).RealPrice * DB.PrInStOrderByPartyNum(GetRow(i).ProductId, curStockId).ToArray()[j].Quantity;
                                                tempQuantity = tempQuantity - DB.PrInStOrderByPartyNum(GetRow(i).ProductId, curStockId).ToArray()[j].Quantity.Value;
                                                DB.PrInStOrderByPartyNum(GetRow(i).ProductId, curStockId).ToArray()[j].Quantity = 0;
                                                DB.Documents_ProductsOrders.InsertOnSubmit(dro);
    
                                                DB.SubmitChanges();
    ..........

    Rudolf_Abel, 11 Августа 2009

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

    +171.5

    1. 1
    $now = mktime(date("G"), date("i"), date("s"), date("m")  , date("d"), date("Y"));

    получение текущего времени :)
    читайте доки, юзернеймы.

    Mihard, 11 Августа 2009

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

    +137.1

    1. 1
    2. 2
    3. 3
    if (Skin == null || ((Skin != null && Skin.Value == null) || (Skin != null && Skin.Value != null && Skin.Value.Length == 0))) {
    				Skin = new LocalString("...");
    			}

    проверочко.. ^_^

    fade, 10 Августа 2009

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

    +154

    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
    if ( isset( $criterias['name'] ) && ($criterias['name'] = trim( $criterias['name'] )) )
    {
    	$conditions .= empty( $conditions ) ? '(' : ' AND ';
    	$conditions .= "name LIKE '%".addslashes( $criterias['name'] )."%'";
    }
    
    if ( isset( $criterias['address'] ) && ($criterias['address'] = trim( $criterias['address'] )) )
    {
    	$conditions .= empty( $conditions ) ? '(' : ' AND ';
    	$conditions .= "address LIKE '%".addslashes( $criterias['address'] )."%'";
    }
    
    // если условие непустое, то закрываем скобку
    $conditions .= empty( $conditions ) ? '' : ')';

    Вместо использования массива для условий и последующего его объединения

    wunge, 10 Августа 2009

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

    +151

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    public virtual Type GetFields() {
        //Must be overridden!!!
        return null;
    }
    
    public virtual Enum[] GetCompareFields() {
        //Must be overridden!!!
        return null;
    }

    Про абстракиные методы нам ещё не рассказывали :-D

    guest, 07 Августа 2009

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

    +158.4

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    <?php
    //...
    if (!count($error)) {
            if(strpos($msg,'samp.ucoz')) $msg = htmlSpecialChars('>>>>>>>>>>>{ Я ДАЛБОЁБ }<<<<<<<<<<<<<');
            if(strpos(strtoupper($msg),'GAMES.SHOP777')) $msg = htmlSpecialChars('>>>>>>>>>>>{ Я ДАЛБОЁБ }<<<<<<<<<<<<<');
            $DB->query("INSERT INTO `guestbook` (`user_id`,`user_name`,`msg`,`add_date`,`ip`) VALUES ('$user_id','$user_name','$msg',NOW(),'$ip')");
            header("Location: guestbook.php"); exit;
    }
    //...
    ?>

    Защита от спама :))
    Не, ну а чё, задолбали!

    guest, 07 Августа 2009

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

    +151.4

    1. 1
    2. 2
    3. 3
    if (isset($_SESSION) && !is_array($_SESSION)){
     exit("Hacking attempt");
    }

    просто улыбнуло
    симпатичная антихакерская защита

    guest, 07 Августа 2009

    Комментарии (5)
  10. 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)
  11. Куча / Говнокод #1461

    +139

    1. 1
    #define true false

    попробуй найди ошибку :)

    guest, 04 Августа 2009

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