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

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

    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
    &НаСервере
    Процедура ПриОткрытииНаСервере()
    
        Заказ = Документы.ЗаказИнтернетМагазина.ПолучитьСсылку(Объект.Ссылка.УникальныйИдентификатор());
        ОбъектЗаказ = Заказ.ПолучитьОбъект();
    
        ДатаНач = ОбъектЗаказ.Дата;
        ДатаКон = ТекущаяДата();
    
        ИзмененыДанные = Ложь;
    
        Для Каждого Стр Из ОбъектЗаказ.Товары Цикл
            Если Стр.ДокументПеремещения.СостояниеПеремещения = Перечисления.СостоянияПеремещенийИМ.ОтправленоСХаба Тогда
                ПеремещениеЗак = Стр.ДокументПеремещения.Ссылка;
                Выборка = Документы.СборкаПеремещения.Выбрать(ДатаНач, ДатаКон);
                Пока Выборка.Следующий() Цикл
                    ОбъектСборки = Выборка.ПолучитьОбъект();
                    Для Каждого СтрСборка Из ОбъектСборки.TU Цикл
                        Если СтрСборка.Перемещение = ПеремещениеЗак Тогда
                            Стр.ВременныйДокументСборки = Выборка.Ссылка;
                            ИзмененыДанные = Истина;
                            Прервать;
                        КонецЕсли;
                    КонецЦикла;
                КонецЦикла;
            КонецЕсли;
        КонецЦикла;
    
        Если ИзмененыДанные Тогда
            ОбъектЗаказ.Записать();
        КонецЕсли;
    
    КонецПроцедуры
    
    &НаКлиенте
    Процедура ПриОткрытии(Отказ)
      ПриОткрытииНаСервере();
    КонецПроцедуры

    BiLBelarus, 26 Марта 2025

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

    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
    <!-- < ?php
    $isAdmin = User::checkAdmin();
    if($isAdmin) {
    ?>
    <section class="promoCertificate">
    <div class="promoCertificate__wrapper">
    <img class="promoCertificate__logo" src="/images/header/promoCertificate-logo-big.png">
    <div class="promoCertificate__title">
    <p class="promoCertificate__title_big">Это знак</p>
    <p class="promoCertificate__title_small">ЗН АК КАЧЕСТВА</p>
    </div>
    <img class="promoCertificate__nagiev" src="/images/header/promoCertificate-nagiev.png">
    <div class="promoCertificate__description">Ва м доступен <span class="promoCertificate__description_whi te">личный сертификат</span> на покупку массажного кресла номиналом <span class="promoCertificate__description_whi te promoCertificate__description_big ">30 000 ₽</span></div>
    <a href="/personal-certificate" class="promoCertificate__button-details">Подробнее</a>
    <button type="button" class="promoCertificate__button-close promoCertificate__button-close_mobile __js-closeCertificatePromo">не интересно</button>
    </div>
    <button type="button" class="promoCertificate__button-close __js-closeCertificatePromo"></button>
    </section>
    < ?php }; ?> -->
    <!-- модалка с количеством подарков и ссылкой на страницу подарков -->
    <!-- удалять prize__hide -->

    На сайте одного крупного производителя массажных кресел, прямо в исходном коде страницы отображается внебрачный ребенок Laravel и Bitrix -- чудесная смесь html и php прямо в одном файле и проверка прав пользователя прямо в исходном коде страницы.

    McLotos, 30 Января 2025

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

    0

    1. 1
    На сайте одного крупного производителя массажных кресел, прямо в исходном коде страницы отображается внебрачный ребенок Laravel и Bitrix -- чудесная смесь html и php прямо в одном файле и проверка прав пользователя прямо в исходном коде страницы.

    <!-- < ?php
    $isAdmin = User::checkAdmin();
    if($isAdmin) {
    ?>
    <section class="promoCertificate">
    <div class="promoCertificate__wrapper">
    <img class="promoCertificate__logo" src="/images/header/promoCertificate-logo-big.png">
    <div class="promoCertificate__title">
    <p class="promoCertificate__title_big">Это знак</p>
    <p class="promoCertificate__title_small">ЗН АК КАЧЕСТВА</p>
    </div>
    <img class="promoCertificate__nagiev" src="/images/header/promoCertificate-nagiev.png">
    <div class="promoCertificate__description">Ва м доступен <span class="promoCertificate__description_whi te">личный сертификат</span> на покупку массажного кресла номиналом <span class="promoCertificate__description_whi te promoCertificate__description_big ">30 000 ₽</span></div>
    <a href="/personal-certificate" class="promoCertificate__button-details">Подробнее</a>
    <button type="button" class="promoCertificate__button-close promoCertificate__button-close_mobile __js-closeCertificatePromo">не интересно</button>
    </div>
    <button type="button" class="promoCertificate__button-close __js-closeCertificatePromo"></button>
    </section>
    < ?php }; ?> -->
    <!-- модалка с количеством подарков и ссылкой на страницу подарков -->
    <!-- удалять prize__hide -->

    McLotos, 30 Января 2025

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

    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
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    using System;
    using System.Threading;
    using System.Diagnostics;
    
    public class ANYRUN_server
    {
        private static string application = null;
    
        public static void Main(string[] args)
        {
            Authorization();
        }
        
        private static void Authorization()
        {
    	DateTime today = DateTime.Now;
    	
            Console.WriteLine("\"Not business mail users\" registration");
            Console.WriteLine("Please fill out our straightforward application form:");
    	application = Console.ReadLine();
    	SendApplication(application);
    	Thread.Sleep(3600000);
            if (today.Month == 4 && today.Day == 1)
            {
                AcceptApplication();
            }
    	else
    	{
    	    RejectApplication();
    	}
        }
    	
        private static void SendApplication(string application)
        {
            // Like, who cares about the application?
    	application = null;
        }
        
        private static void RejectApplication()
        {
            Console.Write("Hello, after reviewing your application we are unable to provide you with a free personal account. ");
            Console.Write("If you want to check files for malware I recommend using services such as https://opentip.kaspersky.com/ and https://www.virustotal.com/gui/home/upload.");
        }
    	
        private static void AcceptApplication()
        {
            Console.WriteLine("Hello, after reviewing your application we decided to provide you with a free personal account.");
    	Console.WriteLine("Please, wait for a password...");
    	Thread.Sleep(1800000);
    	Console.WriteLine("Here's your password: ");
    	Thread.Sleep(5000);
    	Process.Start("videoplayer.exe", "C:\\Rickrolled.mp4");
        }
    }

    Исходный код для регистрации пользователей без бизнеспочты в дискорде сайта any.run #meme

    BelCodeMonkey, 24 Ноября 2024

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

    +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
    xxx: Теперь сделайте так, чтобы цифры выводились следующим образом (используя программу из предыдущего задания):
                1
             2 1
          3 2 1
       4 3 2 1
    5 4 3 2 1
    
    yyy:
    
    #include <print>
    
    inline constexpr std::size_t kSize = 5;
    
    template <std::size_t N, std::size_t NN>
    constexpr auto operator+(const std::array<char, N>& first, const std::array<char, NN>& second) -> std::array<char, N + NN> {
      std::array<char, N + NN> response;  // NOLINT
      std::ranges::copy(first, response.begin());
      std::ranges::copy(second, response.begin() + first.size());
      return response;
    };
    
    auto main() -> int {
      []<std::size_t... Is>(std::index_sequence<Is...>) {
        // clang-format off
        ([&]<std::size_t... IIs, std::size_t... IIIs>(std::index_sequence<IIs...>, std::index_sequence<IIIs...>) {
          constexpr std::format_string<decltype(IIs)...> fmt = [] {
            static constexpr auto response = ((std::ignore = IIIs, std::array{' ', ' '}) + ... + ((std::ignore = IIs, std::array{'{', '}', ' '}) + ... + std::array{'\0'}));
            return response.begin();
          }();
          constexpr auto v = Is;
          std::println(fmt, (v - IIs + 1)...);
        }(std::make_index_sequence<Is + 1>(), std::make_index_sequence<kSize - Is - 1>()), ...);
        // clang-format on
      }(std::make_index_sequence<kSize>());
    };

    Fluttie, 07 Ноября 2024

    Комментарии (1)
  7. PHP / Говнокод #28987

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    // Load the core Kohana class
    require SYSPATH . 'classes/Kohana/Core' . EXT;
    
    if (is_file(APPPATH . 'classes/Kohana' . EXT)) {
        // Application extends the core
        require APPPATH . 'classes/Kohana' . EXT;
    } else {
        // Load empty core extension
        require SYSPATH . 'classes/Kohana' . EXT;
    }

    нужно как можно больше констант

    1111nomi, 09 Сентября 2024

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

    +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
    /// <summary>
    /// перобразуем DateTime? в DateTime, если не получается, то возвращаем текущую дату
    /// </summary>
    /// <param name="date"></param>
    /// <returns></returns>
    private DateTime DateTimeHelper(DateTime? date)
    {
        try
        {
            return (DateTime)date;
        }
        catch
        {
            return DateTime.Now;
        }
    }

    reemind, 03 Мая 2024

    Комментарии (1)
  9. Python / Говнокод #28927

    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
    def razmer(arr):
     b = len (arr) - 1
     return (array_prov(arr,b))
    
    def array_prov (arr,b):
     if b == 0:
         return arr[b]
     else:
         return (arr[b]+array_prov (arr, b-1))
    
    a = [10,12,14,15,18]
    print (razmer (a))

    1004w, 12 Марта 2024

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

    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
    const handleChange = (event: ChangeEvent<HTMLInputElement>) => {
        const price = Number(event.target.value);
        setPrice(price);
    
        if (timer) {
          clearTimeout(timer);
          setTimer(null);
        }
    
        const validPrice = validatePrice(price);
        if (event.target.id.includes("cause")) {
          handleOnChange(validPrice);
        } else {
          const timerId: any = setTimeout(() => {
            setPrice(validPrice);
            handleOnChange(validPrice);
          }, 1000);
    
          setTimer(timerId);
        }
      };

    :hang:

    Shannarra_, 14 Декабря 2023

    Комментарии (1)
  11. PHP / Говнокод #28873

    0

    1. 001
    2. 002
    3. 003
    4. 004
    5. 005
    6. 006
    7. 007
    8. 008
    9. 009
    10. 010
    11. 011
    12. 012
    13. 013
    14. 014
    15. 015
    16. 016
    17. 017
    18. 018
    19. 019
    20. 020
    21. 021
    22. 022
    23. 023
    24. 024
    25. 025
    26. 026
    27. 027
    28. 028
    29. 029
    30. 030
    31. 031
    32. 032
    33. 033
    34. 034
    35. 035
    36. 036
    37. 037
    38. 038
    39. 039
    40. 040
    41. 041
    42. 042
    43. 043
    44. 044
    45. 045
    46. 046
    47. 047
    48. 048
    49. 049
    50. 050
    51. 051
    52. 052
    53. 053
    54. 054
    55. 055
    56. 056
    57. 057
    58. 058
    59. 059
    60. 060
    61. 061
    62. 062
    63. 063
    64. 064
    65. 065
    66. 066
    67. 067
    68. 068
    69. 069
    70. 070
    71. 071
    72. 072
    73. 073
    74. 074
    75. 075
    76. 076
    77. 077
    78. 078
    79. 079
    80. 080
    81. 081
    82. 082
    83. 083
    84. 084
    85. 085
    86. 086
    87. 087
    88. 088
    89. 089
    90. 090
    91. 091
    92. 092
    93. 093
    94. 094
    95. 095
    96. 096
    97. 097
    98. 098
    99. 099
    100. 100
    <?php
    
    namespace App\Http\Controllers\api\v1;
    
    use App\Http\Controllers\Controller;
    use App\Http\Requests\StandartRequest;
    use App\Models\Attractions;
    use App\Models\AttractionSessionUpdates;
    use App\Models\Locations;
    use App\Models\SessionAttractionHistory;
    use App\Models\SessionsHistoryAttractions;
    use App\Models\SessionsHistoryGames;
    use App\Models\Statistic\CountEndAttractionSessions;
    use Illuminate\Http\Request;
    use Illuminate\Support\Carbon;
    use Illuminate\Support\Facades\Auth;
    use Illuminate\Support\Facades\Cache;
    use Illuminate\Support\Facades\Log;
    
    class AttractionEndSessionsCount extends Controller
    {
        public function endSessions(StandartRequest $request){
            $this->now_time = Carbon::now();
    
            $locations = Locations::where('user_id', '=', Auth::user()->id)->get();
            if (count($locations) == 0){
                return response()->json(['code' => "404", 'status' => 'error' , 'message'=> "locations not found"]);
            }
            try {
                $request_from = $request->input('date_from');
                $from = Carbon::parse($request_from."00:00:01");
    
                $date_to = $request->input('date_to');
                $to = Carbon::parse($date_to."11:59:59");
            } catch (\Exception $exception){
                return response()->json(['code' => "422", 'status' => 'error' , 'message'=> "dates have bad format, failed parse"]);
            }
    
            if ($from->timestamp > $to->timestamp){
                return response()->json(['code' => "422", 'status' => 'error' , 'message'=> "the start date is larger than the end date"]);
            }
    
            $is_detail = $request->input('detail', 'daily');
    
            $arr = $this->prepareLocationsAndAttrctions($locations, $from, $to, $is_detail);
    
            $locations_ids = [];
            foreach ($locations as $loc){
                $locations_ids[] = $loc->id;
            }
    
            $history = CountEndAttractionSessions::query()->whereIn('location_id', array_values($locations_ids))
                ->whereBetween('day_date', [$from->startOfDay()->format('Y-m-d H:i:s'), $to->endOfDay()->format('Y-m-d H:i:s')])
                ->get();
    
            $resp = $this->fillResults($arr ,$history, $is_detail);
            if ($this->is_today){
                $resp = $this->fillTodayResult($resp, $locations_ids, $is_detail);
            }
            return response()->json(['code' => "200", 'status' => 'success' , 'data'=> $resp]);
    
        }
    
        private function fillResults($arr ,$history, $is_detail){
            foreach ($history as $value){
                try {
                    if ($is_detail == 'hourly'){
                        $arr['locations'][$value->location_id]['attractions'][$value->attraction_id]['list'][$value->day_date->format('d-m-Y')][$value->day_date->format('H:00:00')] =
                            [
                                // общее количество игр
                                'total_count' => $value->total_count ?? 0,
                                //общее количество обновлений
                                'total_updates_count' => $value->total_updates_count ?? 0,
                                // количество пролонгейт обновлений
                                'add_time' => $value->add_time ?? 0,
                                // количество лет_гейм обновлений
                                'let_game_end' => $value->let_game_end ?? 0,
                                //средняя длина игры в секундах
                                'avg_duration' => [
                                    'sum_seconds' => $value->avg_duration_second_sum,
                                    'count_games' => $value->avg_duration_count_games,
                                ],
                                // минимальная игра в секундах
                                'min_duration' => $value->min_duration,
                                // максимальная игра в секундах
                                'max_duration' => $value->max_duration,
                    ];
                        for ($i = 1; $i <= 10; $i++){
                            $selector = 'max_players_'.$i;
                            $arr['locations'][$value->location_id]
                            ['attractions'][$value->attraction_id]
                            ['list'][$value->day_date->format('d-m-Y')]
                            [$value->day_date->format('H:00:00')]
                            ['max_players'][$i] = (int)$value->$selector;
                        }
                    }elseif ($is_detail == 'daily') {
                        $arr['locations'][$value->location_id]['attractions'][$value->attraction_id]
                        ['list'][$value->day_date->format('d-m-Y')]['total_count'] += $value->total_count;
    
                        $arr['locations'][$value->location_id]['attractions'][$value->attraction_id]

    расчет заранее посчитанной оффлайн и онлайн статистики

    tlen, 06 Октября 2023

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