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

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

    +154

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    function getDateFromTime($dataTime){
      $strDate = date('d-m-Y', $dataTime);
      $arrDate = explode('-', $strDate);
    
      return mktime(0, 0, 0, $arrDate[1], $arrDate[0], $arrDate[2]);
    }

    руки-жопа-голова%)

    warider, 23 Июня 2011

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

    +159

    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
    #include <math.h>
    #include <iostream>
    using namespace std;
    void main()
    { int month,day;
            cin>>month,day;
            int den=1;
            switch(month)
    {       case 1: cout<<"month: "<<month<<endl<<"day: "<<day+1;
    if(day==31){cout<<"month: "<<month+1<<endl<<den;}
    break;
            case 2: cout<<"month: "<<month<<endl<<"day: "<<day+1;
            if(day==28){cout<<"month: "<<month+1<<endl<<"day: "<<den;}
    break;
            case 3:cout<<"month: "<<month<<endl<<"day: "<<day+1;
                    if(day==31){cout<<"month: "<<month+1<<endl<<"day: "<<den;}
    break;
            case 4:cout<<"month: "<<month<<endl<<"day: "<<day+1;
                    if(day==30){cout<<"month: "<<month+1<<endl<<"day: "<<den;}
    break;
            case 5: cout<<"month: "<<month<<endl<<"day: "<<day+1;
                    if(day==31){cout<<"month: "<<month+1<<endl<<"day: "<<den;}
    break;
            case 6: cout<<"month: "<<month<<endl<<"day: "<<day+1;
                    if(day==30){cout<<"month: "<<month+1<<endl<<"day: "<<den;}
    break;
            case 7: cout<<"month: "<<month<<endl<<"day: "<<day+1;
                    if(day==31){cout<<"month: "<<month+1<<endl<<"day: "<<den;}
    break;
            case 8: cout<<"month: "<<month<<endl<<"day: "<<day+1;
                    if(day==31){cout<<"month: "<<month+1<<endl<<"day: "<<den;}
    break;
            case 9: cout<<"month: "<<month<<endl<<"day: "<<day+1;
                    if(day==30){cout<<"month: "<<month+1<<endl<<"day: "<<den;}
    break;
            case 10: cout<<"month: "<<month<<endl<<"day: "<<day+1;
                    if(day==31){cout<<"month: "<<month+1<<endl<<"day: "<<den;}
    break;
            case 11: cout<<"month: "<<month<<endl<<"day: "<<day+1;
                    if(day==30){cout<<"month: "<<month+1<<endl<<"day: "<<den;}
    break;
            case 12: cout<<"month: "<<month<<endl<<"day: "<<day+1;
                    if(day==31){cout<<"month: "<<month+1<<endl<<"day: "<<den;}
                    
                                    
    }       
     
    cin.get();
            cin.get();
    }

    Juris_Kabanis, 20 Июня 2011

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

    +159

    1. 1
    2. 2
    3. 3
    function doXmlEscape($val) {
      return str_replace(array('&', '<', '>', '"', "'"), array('&', '<', '>', '"', '''), $val);
    }

    http://vkontakte.ru/developers.php?o=-1&p=%D0%9F%D1%80%D0%B8%D0%BC%D0%B5%D1%80 +%D0%BE%D0%B1%D1%80%D0%B0%D0%B1%D0%BE%D1 %82%D1%87%D0%B8%D0%BA%D0%B0+%D1%83%D0%B2 %D0%B5%D0%B4%D0%BE%D0%BC%D0%BB%D0%B5%D0% BD%D0%B8%D0%B9+%D0%BD%D0%B0+%D1%8F%D0%B7 %D1%8B%D0%BA%D0%B5+PHP

    Ох и разработчики... T_T

    inf, 17 Июня 2011

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

    +154

    1. 1
    2. 2
    3. 3
    4. 4
    $value = $this->model->getById(DataUtil::fromGET("id"));
    foreach($this->model->get(PaginationUtil::getStart(),PaginationUtil::$countOnPage) as $value){
       return NewsUtils::createNewsLayout_ND($value);
    }

    В проект был взят стажер, и начал появляться такой вот индусский код.

    Kos, 17 Июня 2011

    Комментарии (12)
  6. Java / Говнокод #6972

    +147

    1. 1
    2. 2
    3. 3
    if(entry.getName().equals("back.jpg"));{
    
    }

    просто смешная (но с последствиями) опечатка

    Lure Of Chaos, 16 Июня 2011

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

    +121

    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
    // первай варянт
    string[] GetMonth = 
    { 
        "Январь", "Февраль", "Март", "Апрель", 
        "Май", "Июнь", "Июль", "Август", "Сентябрь", 
        "Октябрь", "Ноябрь", "Декабрь" 
    };
    for (int i = 1; i <= 12; i++)
    {
         Console.WriteLine(GetMonth[i]);
    }
    
    // вторый варянт
    
    System.Globalization.DateTimeFormatInfo mfi = new System.Globalization.DateTimeFormatInfo();
    for(int i = 1; i <= 12; i++)
    {
        string strMonthName = mfi.GetMonthName(i).ToString();
        Console.WriteLine(strMonthName);
    }

    Как в C# автоматически получить массив или список всех месяцев года (январь ... декабрь)?

    Paragraf, 12 Июня 2011

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

    +156

    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
    class sqlinj
    {
    ...
    public $liste=array("=","\'","\"","*","\-","declare","char","set","cast","convert","drop","exec","meta","script","select","truncate","insert","delete","union","update","create","where","join","information_schema","table_schema","into");
    ...
    private function tumsorgular($yapilacak){ 
                switch ($yapilacak){ 
                case "post": 
                $this->islet=array("POST"); 
                break; 
                case "get": 
                $this->islet=array("GET"); 
                break; 
                case "request": 
                $this->islet=array("REQUEST"); 
                break; 
                case "aio": 
                $this->islet=array("POST","GET","REQUEST"); 
                break; 
            }     
            foreach($this->islet as $islem){ 
            eval('foreach($_'.$islem.' as $ad=>$deger){ 
                $_'.$islem.'[$ad]=$deger; 
                foreach($this->liste as $bul){ 
                $_'.$islem.'[$ad]=str_replace($bul,"\\\".$bul."\\\",$_'.$islem.'[$ad]); 
                } 
            } 
    ...
    }

    [url=http://www.phpclasses.org/browse/file/35305.html]Basic SQL Injection Protection[/url]
    Cleanup harmful text from request parameters

    Взято с phpclasses.org.
    Новый тип говнокода- турецкий(описание: расходится по швам при первой носке)

    А чё, ... не попортим так хакнем ;D

    AlexanderC, 10 Июня 2011

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

    +157

    1. 1
    2. 2
    3. 3
    function smallfil($string)
    {       return mysql_real_escape_string($string);
            }

    Что не сделаешь ради удобства?

    gostoff, 05 Июня 2011

    Комментарии (12)
  10. Java / Говнокод #6790

    +147

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    public void assert(boolean t)
        {
            if(!t)
            {
                throw new Error();
            } else
            {
                return;
            }
        }

    Lure Of Chaos, 30 Мая 2011

    Комментарии (12)
  11. Си / Говнокод #6778

    +148

    1. 1
    2. 2
    3. 3
    4. 4
    if((s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == INVALID_SOCKET) die("socket creating.");
    if(bind(s, (struct sockaddr*) &local, sizeof(struct sockaddr_in)) == SOCKET_ERROR) die("bind...");
    if(ioctlsocket(s, FIONBIO, &on) != 0) die("IOCTL!!!");
    if(listen(s, 16) != 0) die("WHYYYYY?!?!!!!!");

    No hard feelings.

    danilissimus, 29 Мая 2011

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