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

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

    0

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    var text_message = "";	
    text_message += "\n Вопрос №1: " + $('input[name=question_0]:checked').parent().parent().parent().find(".title").text() + " Ответ: " + $('input[name=question_0]:checked').val();
    text_message += "\n Вопрос №2: " + $('input[name=question_1]:checked').parent().parent().parent().find(".title").text() + " Ответ: " + $('input[name=question_1]:checked').val();
    text_message += "\n Вопрос №3: " + $('input[name=question_2]:checked').parent().parent().parent().find(".title").text() + " Ответ: " + $('input[name=question_2]:checked').val();
    text_message += "\n Вопрос №4: " + $('input[name=question_3]:checked').parent().parent().parent().find(".title").text() + " Ответ: " + $('input[name=question_3]:checked').val();
    text_message += "\n Вопрос №5: " + $('input[name=question_4]:checked').parent().parent().parent().find(".title").text() + " Ответ: " + $('input[name=question_4]:checked').val();
    text_message += "\n Вопрос №6: " + $('input[name=question_5]:checked').parent().parent().parent().find(".title").text() + " Ответ: " + $('input[name=question_5]:checked').val();

    ууууиииииии

    ishurgaya, 26 Февраля 2019

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

    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
    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
    public function passes($attribute, $hostname)
        {
            if (!mb_stripos($hostname, '.')) {
                return false;
            }
    
            $domain = explode('.', $hostname);
            $allowedChars = ['-'];
            $extenion = array_pop($domain);
    
            foreach ($domain as $value) {
                $fc = mb_substr($value, 0, 1);
                $lc = mb_substr($value, -1);
    
                if (
                    hash_equals($value, '')
                    || in_array($fc, $allowedChars)
                    || in_array($lc, $allowedChars)
                ) {
                    return false;
                }
    
                if (!ctype_alnum(str_replace($allowedChars, '', $value))) {
                    return false;
                }
            }
    
            if (
                !ctype_alnum(str_replace($allowedChars, '', $extenion))
                || hash_equals($extenion, '')
            ) {
                return false;
            }
    
            if (filter_var($hostname, FILTER_VALIDATE_DOMAIN) === false) {
                return false;
            }
    
            return true;
        }

    валидация домена...

    websbkinfo, 09 Февраля 2019

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

    +1

    1. 1
    https://imgur.com/a/IgqXRK7

    BelCodeMonkey, 13 Декабря 2018

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

    −106

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

    Wrotberry, 09 Ноября 2018

    Комментарии (10)
  7. 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)
  8. 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)
  9. 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)
  10. 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)
  11. 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)