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

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

    +140

    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
    <?php
    
    if ($_POST['act']=='addstuff')
    {
      //print_r($_POST);
      $c_config=array(
        'slider1_title'=>($_POST['slider1_title']),
        'slider1_text'=> ($_POST['slider1_text']),
        'slider1_link'=> ($_POST['slider1_link']),
        'slider1'=>      ($_POST['slider1']),
        'slider2_title'=>($_POST['slider2_title']),
        'slider2_text'=> ($_POST['slider2_text']),
        'slider2_link'=> ($_POST['slider2_link']),
        'slider2'=>      ($_POST['slider2']),
        'slider3_title'=>($_POST['slider3_title']),
        'slider3_text'=> ($_POST['slider3_text']),
        'slider3_link'=> ($_POST['slider3_link']),
        'slider3'=>      ($_POST['slider3']),
        'slider4_title'=>($_POST['slider4_title']),
        'slider4_text'=> ($_POST['slider4_text']),
        'slider4_link'=> ($_POST['slider4_link']),
        'slider4'=>      ($_POST['slider4']),
        'slider5_title'=>($_POST['slider5_title']),
        'slider5_text'=> ($_POST['slider5_text']),
        'slider5_link'=> ($_POST['slider5_link']),
        'slider5'=>      ($_POST['slider5']),
        'number_title'=>($_POST['number_title']),
        'number_text'=> ($_POST['number_text']),
        'number_link'=> ($_POST['number_link']),
        'date_title'=>($_POST['date_title']),
        'date_text'=> ($_POST['date_text']),
        'date_link'=> ($_POST['date_link']),
        'banner_link'=> ($_POST['banner_link']),
        'banner'=> ($_POST['banner'])
      );
      $c_config=json_encode($c_config);
      if (intval($_POST['category_id'])>0)
      {
        $db->query('UPDATE ecrm_category set category_name=\''.addslashes($_POST['category_name']).'\', category_config=\''.addslashes($c_config).'\', category_img=\''.addslashes($_POST['category_img']).'\', category_type=\''.intval($_POST['category_type']).'\' WHERE category_id='.intval($_POST['category_id']));
        //echo 'UPDATE ecrm_category set category_name=\''.addslashes($_POST['category_name']).'\', category_config=\''.addslashes($c_config).'\', category_img=\''.addslashes($_POST['category_img']).'\', category_type=\''.intval($_POST['category_type']).'\' WHERE category_id='.intval($_POST['category_id']);
      } else{
        $db->query('INSERT INTO ecrm_category (category_name,category_config,category_img,category_parent,category_type) VALUES (\''.addslashes($_POST['name']).'\',\''.$c_config.'\',\''.addslashes($_POST['category_img']).'\','.intval($_POST['category_parent']).','.intval($_POST['category_type']).')');
      }
    }

    damir, 09 Июля 2015

    Комментарии (3)
  3. Си / Говнокод #18446

    +140

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    int __STRNCMP__(const char s1, const char s2, size_t n)
    {
     for (; n > 0; s1++, s2++, --n)
     if (s1 != s2)
      return (((unsigned char )s1 < (unsigned char )s2) ? -1 : +1);
     else if (*s1 == '\0')
      return 0;
     return 0;
    }

    Зачем нужен такой велосипед?

    Cynicrus, 07 Июля 2015

    Комментарии (6)
  4. Си / Говнокод #18238

    +140

    1. 1
    2. 2
    3. 3
    4. 4
    /*
     * To the unenlightened: This sets the X (where X is variable between calls) LSB's of mask to 1.
     */
    mask = ~(~0 << X);

    Байтопроблемушки. Me gusta.

    codemonkey, 27 Мая 2015

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

    +140

    1. 1
    http://phpocean.com/tutorials/back-end/create-your-first-desktop-application-with-php-and-php-desktop/4

    верстка самого сайта, phpdesktop, zooboole - у меня жестко бортануло

    Fike, 20 Мая 2015

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

    +140

    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
    <?php
    /**
      * @desc Локализация сайта
      *
      **/
    class System_Message{
      private function openLangFail($lang){
        $path = '/../message/'.$lang.'.php';
        if (file_exists($path)) {
          return 'File with languages not found';
        } else {
          return include $path; 
        }
      } 
      
      public function getLang($value, $lang='ru'){
        $lang = self::openLangFail($lang);
        if($lang[$value] != '') {
          return $lang[$value];
        } else {
    	  return false;
    	}
      }
    }

    Ну как?

    Dev_18, 12 Мая 2015

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

    +140

    1. 1
    2. 2
    3. 3
    4. 4
    void GetPublicKey(char *destination, int len)
    {
    	GetPrivateKey(destination, len);
    }

    pmiller, 23 Апреля 2015

    Комментарии (1)
  8. Си / Говнокод #17643

    +140

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    GNET::ChatBroadCast::~ChatBroadCast(&cbc);
      }
      else if ( v9 > 9 && v9 == 14 )
      {
        v4 = this->roleid;

    Декомпилил тут игруху, а там такое в псевдокоде.

    DesmondHume, 14 Февраля 2015

    Комментарии (32)
  9. Си / Говнокод #17313

    +140

    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
    HIMAGELIST ImageList_LoadImageV(PVOID ImageBase, PCWSTR a[], int level)
    {
    	PIMAGE_RESOURCE_DATA_ENTRY pirde;
    	PBITMAPINFOHEADER pbih;
    	DWORD cx, cy, cb, n, ofs;
    	if (
    		0 <= LdrFindResource_U(ImageBase, a, level, &pirde) && 
    		0 <= LdrAccessResource(ImageBase, pirde, (void**)&pbih, &cb) &&
    		cb > sizeof(BITMAPINFOHEADER) &&
    		pbih->biSize >= sizeof(BITMAPINFOHEADER) &&
    		(cx = pbih->biWidth) <= (cy = pbih->biHeight) &&
    		!(cy % cx) &&
    		pbih->biBitCount == 32 &&
    		(ofs = pbih->biSize) + (cx * cy << 2) == cb
    		)
    	{
    		n = cy / cx, cb = cx * cx << 2;
    
    		if (HIMAGELIST himl = ImageList_Create(cx, cy, ILC_COLOR32, n, 0))
    		{
    			BITMAPINFO bi = { {sizeof(BITMAPINFOHEADER), cx, cx, 1, 32 } };
    
    			if (HDC hdc = GetDC(0))
    			{
    				if (HBITMAP hbmp = CreateCompatibleBitmap(hdc, cx, cx))
    				{
    					do ; while (
    						SetDIBits(hdc, hbmp, 0, cx, RtlOffsetToPointer(pbih, ofs), &bi, DIB_RGB_COLORS) &&
    						0 <= ImageList_Add(himl, hbmp, 0) &&
    						(ofs += cb, --n)
    						);
    
    					DeleteObject(hbmp);
    				}
    
    				ReleaseDC(0, hdc);
    			}
    
    			if (!n) return himl;
    
    			ImageList_Destroy(himl);
    		}
    	}
    
    	return 0;
    }

    zhukas, 14 Декабря 2014

    Комментарии (26)
  10. Pascal / Говнокод #17020

    +140

    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
    type func = function (x : real) : real;
    const
    	eps = 0.0000003;
    	pi = 3.14159265358979;
    function Integral (f : func; a, b : real) : real;
    var center : real;
    begin
    	center := (a + b) / 2;
    	if abs(b - a) < eps then
    		Integral := f(center) * (b - a)
    	else Integral := Integral(f, a, center) + 
    		Integral(f, center, b);
    end;
    function myFunc(x : real) : real;
    begin
    	myFunc := cos(x) / x;
    end;
    begin
    	writeln(Integral(myFunc, pi/2, pi));
    	readln;
    end.

    Толи я дурачек, толи автор кода - школьник....

    ShadowXX, 02 Ноября 2014

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

    +140

    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
    virtual QModelIndex parent(const QModelIndex &child) const = 0;
    
        virtual QModelIndex sibling(int row, int column, const QModelIndex &idx) const;
        virtual int rowCount(const QModelIndex &parent = QModelIndex()) const = 0;
        virtual int columnCount(const QModelIndex &parent = QModelIndex()) const = 0;
        virtual bool hasChildren(const QModelIndex &parent = QModelIndex()) const;
    
        virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const = 0;
        virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
    
        virtual QVariant headerData(int section, Qt::Orientation orientation,
                                    int role = Qt::DisplayRole) const;
        virtual bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value,
                                   int role = Qt::EditRole);
    
        virtual QMap<int, QVariant> itemData(const QModelIndex &index) const;
        virtual bool setItemData(const QModelIndex &index, const QMap<int, QVariant> &roles);
    
        virtual QStringList mimeTypes() const;
        virtual QMimeData *mimeData(const QModelIndexList &indexes) const;
        virtual bool canDropMimeData(const QMimeData *data, Qt::DropAction action,
                                     int row, int column, const QModelIndex &parent) const;
        virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action,
                                  int row, int column, const QModelIndex &parent);

    ну, вы поняли. они написали тысячи говнокода и говорят, что это круто.
    они написали говно-пример, и говорят, что это круто.
    а вы что думаете по этому поводу?

    FadeToBlack, 29 Октября 2014

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