- 1
На сайте одного крупного производителя массажных кресел, прямо в исходном коде страницы отображается внебрачный ребенок Laravel и Bitrix -- чудесная смесь html и php прямо в одном файле и проверка прав пользователя прямо в исходном коде страницы.
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
0
На сайте одного крупного производителя массажных кресел, прямо в исходном коде страницы отображается внебрачный ребенок 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 -->
0
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
+1
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>());
};
0
// 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;
}
нужно как можно больше констант
+1
/// <summary>
/// перобразуем DateTime? в DateTime, если не получается, то возвращаем текущую дату
/// </summary>
/// <param name="date"></param>
/// <returns></returns>
private DateTime DateTimeHelper(DateTime? date)
{
try
{
return (DateTime)date;
}
catch
{
return DateTime.Now;
}
}
0
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))
0
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:
0
<?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]
расчет заранее посчитанной оффлайн и онлайн статистики
0
#include <ctype.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int evaluatePostfixExpression_2(char *, int memory_smp[], int *count_command);
int calculate_2(int, int, char, int memory_smp[], int *count_command);
typedef struct mode_intro {
int type;
int data[2];
} expr_if;
int main(int argc, char *argv[]) {
expr_if rn_data[125];
/* != */
rn_data[94].type = 2;
rn_data[94].data[0] = 4100;
rn_data[94].data[1] = 4100;
/* != */
/* == */
rn_data[122].type = 1;
rn_data[122].data[0] = 4200;
/* == */
/* <= */
rn_data[121].type = 2;
rn_data[121].data[0] = 4200;
rn_data[121].data[1] = 4100;
/* <= */
/* < Øèâîðîò íà âûâîðîò */
rn_data[60].type = 1;
rn_data[60].data[0] = 4100;
/* < */
/* >= */
rn_data[123].type = 2;
rn_data[123].data[0] = 4200;
rn_data[123].data[1] = 4100;
/* >= */
/* > */
rn_data[62].type = 1;
rn_data[62].data[0] = 4100;
/* > */
char infix[150];
char postfix[150];
int line_simple_comands_input_print(int cmd, data *table, int token,
int memory[]);
int past_in_table_cons_or_value(data * table, char *str_tok);
int ab = 0;
int swp = 0;
int goto_search(data * table, char *token);
int search_cmd(char *dict[15], char *token);
char *comparison_signs = "> < <= >= == !=";
int token_string_count = 0;
data symbolTable[100];
int cnt = 0;
int d = 0;
int count_if = 0;
int flags[100];
int mem_smp[100];
char copy_buf_data[150][150] = {{0}};
char post_buf[150];
int count_cmd = 0;
int sign_ch;
FILE *file_buf;
char *buffer = 0;
char *intro_buffer = 0;
int save_left_side = 0, save_exp = 0;
int goto_flag = 0;
int count_table_intro = 0;
int count_table_extra = 0;
char name_file[100];
char buffer_postfix[150];
char buf_data[150][150] = {{0}};
int val_if[3] = {0};
int data_if[150] = {0};
data_if[60] = 4100;
data_if[61] = 1;
Симплтрон из задачи по Дейтелам
1
+1
#include "Windows.h"
void line::draw()
{
CmdWinGUI::draw();
uint8_t modB = 0; //modeByte
COORD tempSt = lineStart;
COORD tempEn = lineEnd;
SHORT dX = abs(lineEnd.X - lineStart.X);
SHORT dY = abs(lineEnd.Y - lineStart.Y);
SHORT sX = lineStart.X < lineEnd.X ? 1 : -1;
SHORT sY = lineStart.Y < lineEnd.Y ? 1 : -1;
SHORT dErr = dX - dY;
SHORT dErr2 = 0;
if (scan)
{
SetConsoleCursorPosition(hCon, lineStart);
for (uint8_t a = 0;a <= lineEnd.X-lineStart.X;++a)
{
modB = lineAtrBuffer[a];
SetConsoleTextAttribute(hCon, modB);
printf("%c", lineSymBuffer[a]);
}
if (isChanged)
this->editFlagSwitch();
return;
}
for (;;)
{
SetConsoleCursorPosition(hCon, tempSt);
printf("%c", lineSym);
if (tempSt.X == tempEn.X&&tempSt.Y == tempEn.Y)
break;
dErr2 = dErr * 2;
if (dErr2 > -dY)
{
dErr -= dY;
tempSt.X += sX;
}
if (dErr2 < dX)
{
dErr += dX;
tempSt.Y += sY;
}
}
if (isChanged)
this->editFlagSwitch();
}
Отрисовка произвольной графической линии в консоли