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

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

    +155.3

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    function gp($gp){ 
      $gp_res=$_GET[$gp]; 
      if ($gp_res == ''){
        $gp_res=$_POST[$gp];
      } 
      return $gp_res;
    }

    а поидее можно было юзать $_REQUEST[$gp]

    popstas, 21 Октября 2009

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

    +144.7

    1. 1
    2. 2
    3. 3
    4. 4
    <form ....
    <a href="#" class="lalalala" onclick="$('#frm').submit()">Подтвердить</a>
    ...
    </form>

    изначально было так
    в админке ))

    paranoid, 21 Октября 2009

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

    +144.8

    1. 1
    2. 2
    $uploaddir = '../images/';
    $uploadfile1 	= $uploaddir . basename($_FILES['img']['name']);

    все те же индусы

    getme, 16 Октября 2009

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

    +56.6

    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
    class         inTm: public ioTm
            {           public: inTm(){ startInTm(); buffer=temp; };
                           int  readTm (tmData&);
                  virtual void  message(const structMessage&){};
                          void  inputArray (int);
                          void  setNonBlock(int);
                          void  startInTm();
                          long  readTmPos(tmData&);
                     protected:
                unsigned  char  temp[lengthBuffer];
              virtual unsigned  char* readBuffer(int&)=0;
                           int  inputBuffer();
                          void  convertTm(unsigned char*, tmData&);
                  virtual long  getPos(){ return current-count-countTemp; };
                       private:
                          void  cnvTmPC  (unsigned char*, tmData&);
                          void  cnvTmNet (unsigned char*, tmData&);
                        friend  inTmBl;
                        friend  finTm;
                           int  count;
                           int  lengthIn;
                unsigned  char* tempBuf;
                           int  countTemp;
            };

    Программист Мудрецов (фамилия у человека такая) был большим затейником. Например, код на С++ в хидерах он формативровал по центру - как стихи.
    P. S. Надеюсь, на сайте форматирование сохранится.

    Dimarius, 01 Сентября 2009

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

    +176.4

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    if($n==1 or $n==3 or $n==3 or $n==4 or $n==5) {
    if($n ==1 ) {$result = mysql_query("SELECT * FROM spec WHERE id_fac='$id_fac' and 1c='1' and id_sett='1'");}
    if($n ==2 ) {$result = mysql_query("SELECT * FROM spec WHERE id_fac='$id_fac' and 2c='1' and id_sett='1'");}
    if($n ==3 ) {$result = mysql_query("SELECT * FROM spec WHERE id_fac='$id_fac' and 3c='1' and id_sett='1'");}
    if($n ==4 ) {$result = mysql_query("SELECT * FROM spec WHERE id_fac='$id_fac' and 4c='1' and id_sett='1'");}
    if($n ==5 ) {$result = mysql_query("SELECT * FROM spec WHERE id_fac='$id_fac' and 5c='1' and id_sett='1'");}}

    кусок из примера кода, который чувак прислал к нам в контору вместе с резюме

    nolka4, 21 Августа 2009

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

    +137

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    if (messages[i].description != "")
                                if (messages[i].description.StartsWith("<![CDATA["))
                                {
                                    messages[i].description = messages[i].description.Substring(9);
                                    messages[i].description = messages[i].description.Substring(0, messages[i].description.Length - 3);
                                }

    для строк типа <![CDATA[******]!>
    Возникает устойчивое ощущение говнокода. Как нормально написать? :)

    ikovalyov, 16 Августа 2009

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

    +133.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
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    /// <summary>
    /// General handler for all buttons
    /// </summary>
    private void FormButtons_Click(object sender, EventArgs e)
    {
        Control control = (Control) sender;
    
        if (control.Handle == btnCreateInvoices.Handle)
            ExportOrders();
        else if (control.Handle == btnFirstUsageInvoices.Handle)
            ExportFirstUsageInvoices();
        else if (control.Handle == btnImportCustomers.Handle)
            ImportCustomers();
        else if (control.Handle == btnImportProdcuts.Handle)
            ImportProducts();
        else if // и так далее...
    }

    WinForms приложение, на все кнопки навешен 1 обработчик события OnClick.
    А внутри вот....

    vleschenko, 12 Августа 2009

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

    +142.5

    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
    $out="<table valign=top>";
    for($k = 0; $k <= 6; $k += 1){     
        $sql="SELECT * FROM user_news1 ORDER BY date DESC LIMIT ".$k.",1";         
        $query=mysql_query($sql);
        $out.="<tr>";     
        while ($res=mysql_fetch_assoc($query)){
         $out.="<td style='vertical-align:top'>
               <div class=newsblock>
               <div class=newsdate>".date("d.m.Y G:i",strtotime($res['date']))."</div>
               <div class=newschapter><a href='/news/".$res['id'].".html'>".$res['header']."</a></div>
               ".($res['photo']!= '' ? " <a href='/news/".$res['id']."'><img src=/".str_replace(".", "_small.", $res['photo'])." class=imgnews border=0 align=left></a> " : "")."
               <div>".$res['announce']."</div></td>";
         }
        
        $out.="</tr>";
    }    
    $out.="</table>";
    
    
    echo $out;

    Вот как надо новости выводить:)

    guest, 07 Августа 2009

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

    +50.8

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    $find = str_replace(",", "", $find);
    $find = str_replace(".", "", $find);
    $find = str_replace("/", "", $find);
    $find = str_replace(" ", "", $find);
    $find = str_replace("-", "", $find);
    $find = str_replace("+", "", $find);
    $find = str_replace("#", "", $find);

    Регулярные выражения =)

    guest, 08 Декабря 2008

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

    −53.9

    1. 1
    2. 2
    3. 3
    uint32_t getuint32(char *p){
      return (*p<<24)|(*(p+1)<<16)|(*(p+2)<<8)|(*(p+3));
    }

    guest, 27 Ноября 2008

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