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

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

    −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
    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
    $type = ($_POST['type'] == 'any') ? '' : str_replace(' ', '%20', str_replace('|','%7C', $_POST['type']));
    $make = ($_POST['make'] == 'any') ? '' : str_replace(' ', '%20', str_replace('|','%7C', $_POST['make']));
    $url = 'http://www.cycletrader.com/search-results?sort=featured%3Aasc&page='.$_POST['page'].'&type='.$type.'&make='.$make;
    $str = getCurlObject($url);
    $content = multiexplode('<div id="searchPage"', '<div class="footer', $str);
    $list = multiexplode('<div id="gridView"', '<div class="rezDetailsBtm', $content);
    $field = explode('<div data-url=', $list);
    for ($k = 1; $k < count($field); $k++) {
        $title_tmp = multiexplode('<a class="listing-info-title', '</a>', $field[$k]);
        $title = multiexplode('title="', '"', $title_tmp);
        $link = $lang['dir'].'detail?'.$_POST['form'].'&'.multiexplode('href="', '"', $title_tmp);
        $img_tmp = multiexplode('<img', '/>', $field[$k]);
        $img = multiexplode('data-src="', '"', $img_tmp);
        $price_tmp = multiexplode('class="price', '</span>', $field[$k]);
        if (strripos($price_tmp,'<span class="mileage">')) {
            $price = multiexplode('<span>', '<span', $price_tmp);
        } else {
            $price = multiexplode('<span>', '</span>', $price_tmp);
        }
        if (trim($price) == 'Call for price') $price = '';
        $result['item'][$k]['link'] = $link;
        $result['item'][$k]['title'] = $title;
        $result['item'][$k]['img'] = $img;
        $result['item'][$k]['price'] = $price;
        $result['item'][$k]['location'] = $location;
    }
    
    if (strripos($content,'<div class="pagination')) {
        $pagination = multiexplode('<div class="pagination', '</div>', $content);
        $pagination_tmp = multiexplode('<span class="hidden-xs','</div>', $pagination);
        $pagination_item = explode('<li', $pagination);
        if (count($pagination_item) > 6) {
            $result['pagination'] = true;
        }
    }

    Стандартный похокод пыходибила.

    хуита, 28 Ноября 2018

    Комментарии (10)
  3. Куча / Говнокод #25067

    −106

    1. 1
    Скрипаль заебал, Хачатурян заебал, Хабиб заебал, Мамаев заебал, Кокорин заебал, Цеповяз остоёб.

    Wrotberry, 09 Ноября 2018

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

    +4

    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
    unit ZwDeleteFileSample;
    
    interface
    
    uses Windows, nt_status, native, hal, fcall, macros, ntoskrnl;
    
    function _DriverEntry(DriverObject: PDriverObject; RegistryPath: PUnicodeString): NTSTATUS; stdcall;
    
    implementation
    
    procedure DriverUnload(pDriverObject: PDriverObject); stdcall;
    begin
      DbgPrint('Test Driver :: Unloaded');
    end;
    
    function _DriverEntry(DriverObject: PDriverObject; RegistryPath: PUnicodeString): NTSTATUS; stdcall;
    var UNICODESTRING: UNICODE_STRING;
      obj: OBJECT_ATTRIBUTES;
    
    begin
    
      DbgPrint('Test Driver :: Loaded');
      DriverObject^.DriverUnload := @DriverUnload;
    
      RtlInitUnicodeString(UNICODESTRING, '\??\C:\test.exe');
      InitializeObjectAttributes(obj, @UNICODESTRING, OBJ_CASE_INSENSITIVE + OBJ_KERNEL_HANDLE, 0, nil);
      Result := ZwDeleteFile(@obj);
    
      if Result = STATUS_SUCCESS then
      begin
        DbgPrint('File deleted sucessfully - Result:0x%.8X', Result); // Result to get Error Code
      end else
      begin
        DbgPrint('Fail to delete file - Result:0x%.8X', Result); // Result to get Error Code
        DbgPrint('Object name :%wZ',  obj.ObjectName); // Result to get Error Code
      end;
      Result := STATUS_SUCCESS;
    
    end;
    
    end.

    Драйвер на дэлфи. Ничего необычного, листайте дальше.

    blackray, 29 Октября 2018

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

    0

    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
    Vector_type(const Vector_type& m1) {
    		if (this->size != m1.size) {
    			if (this->size != 0)
    				destroy_memmory();
    			this->size = m1.size;
    			this->M = new m_type[size];
    			for (int i = 0; i < size; i++)
    				this->M[i] = m1.M[i];
    		}
    		else {
    			for (int i = 0; i < size; i++)
    				this->M[i] = m1.M[i];
    		}
    	};
    	Vector_type& operator = (const Vector_type& m1) {
    		if (this->size != m1.size)
    			throw "not right =";
    		for (int i = 0; i < size; i++)
    			this->M[i] = m1.M[i];
    		return *this;
    	};

    Действительно что могло пойти не так? просто копировать приравнять, копировать, приравнять, копировать...

    cat_code, 12 Октября 2018

    Комментарии (10)
  6. C# / Говнокод #24895

    +1

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    // todo '+1' is temporary
    private string CorrectPhoneNumber(string phoneNumber, string countryCode = "+1")
    {
    	if (phoneNumber.Substring(0, 1) != "+")
    	{
    		return string.Format("{0}{1}", phoneNumber.Length == 10 ? countryCode : "+", phoneNumber);
    	}
    
    	return phoneNumber;
    }

    Genious!

    Moses, 11 Октября 2018

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

    −2

    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
    <a class="callformtrigger"  href="http://#ck_callback_button"><!-- container box --></a>
    <script>
    (function(){
    	try{
                var el = $("a.callformtrigger");
                var hash = el.attr("href");
                hash = hash.replace("http://", "");
                el.attr("href", hash);
    	}
    	catch(e)
    	{
    		/** **/
    	}
    })();
    </script>

    вместо того, чтобы поправить данный url в исходниках, был применен данный способ

    turbosnail, 26 Сентября 2018

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

    0

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    // тухло 
    if (json.Contains("message")) 
    { 
        classOperatios.ResultOper2 result2 = JsonConvert.DeserializeObject<classOperatios.ResultOper2>(json); 
        MessageBox.Show(result2.message + (char)13 + (char)10 + result2.errors); 
    }

    Царский код. Как склеить две строки с разделителем "новая строка".

    awesome3000, 25 Сентября 2018

    Комментарии (10)
  9. Куча / Говнокод #24796

    −1

    1. 1
    2. 2
    3. 3
    4. 4
    const (
    	millisPerSecond     = int64(time.Second / time.Millisecond)
    	nanosPerMillisecond = int64(time.Millisecond / time.Nanosecond)
    )

    Автор предусмотрел возможность изменения СИ.

    cheshir, 21 Сентября 2018

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

    −2

    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
    int[][] arr = new int[3][];
                arr[0] = new int[3];
                arr[1] = new int[2];
                arr[2] = new int[5];
                arr[0][2] = 16;
                arr[1][0] = 45;
                arr[2][4] = 99;
                foreach (int item in arr[0])
                    Console.Write(item + " ");
                Console.WriteLine();
                foreach (int item in arr[1])
                    Console.Write(item + " ");
                Console.WriteLine();
                foreach (int item in arr[2])
                    Console.Write(item + " ");
    
    Этот foreach просто божественен

    Auzergos, 14 Сентября 2018

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

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    private Integer getIntegerValue(int length) throws PivotReadExeption {
            getValue(length);
            return this.stringBuffer.toString().trim().isEmpty()?0:Integer.valueOf(this.stringBuffer.toString());
        }
    
        private BigDecimal getDoubleValue(int length) throws PivotReadExeption {
            getValue(length);
            if(this.stringBuffer.toString().trim().isEmpty()) return null;
            return new BigDecimal(this.stringBuffer.toString().trim());
        }

    Сотрудник выдал. Это говнокод или нет?

    gaal, 11 Сентября 2018

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