- 1
Время вечерней молитвы.
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
0
Время вечерней молитвы.
Примите положение А1. Постарайтесь сосредоточиться, соберитесь с мыслями. Прочтите молитву.
Инициализируйте процедуру-коллбек.
0
Application was halted by an exception.
Error 520
Ray ID: 69e3d61cfd95169b •
2021-10-14 21:18:17 UTC
Web server is returning an unknown error
You
Browser Working
Moscow
Cloudflare Working
govnokod.ru
Host Error
What happened?
There is an unknown connection issue between Cloudflare and the origin web server. As a result, the web page can not be displayed.
What can I do?
If you are a visitor of this website:
Please try again in a few minutes.
If you are the owner of this website:
There is an issue between Cloudflare's cache and your origin web server. Cloudflare monitors for these errors and automatically investigates the cause. To help support the investigation, you can pull the corresponding error log from your web server and submit it our support team. Please include the Ray ID (which is at the bottom of this error page). Additional troubleshooting resources.
Cloudflare Ray ID: 69e3d61cfd95169b
Your IP: 91.197.11.236
Performance & security by Cloudflare
+2
if($response == null){
echo "<pre>";
var_dump($response);
echo "</pre>";
die();
}
Таким способом выводится на экран надпись NULL
0
#define MAKE(a1, a2, m1, m2) if(arg1s == a1 && arg2s == a2)\
sprintf_s(opcode_buffer, format.c_str(), opcodeToString((Opcode)opcode.opcode).c_str(), m1, m2)
MAKE(I, I, iarg1 , iarg2 );
MAKE(S, I, arg1.c_str(), iarg2 );
MAKE(I, S, iarg1 , arg2.c_str());
MAKE(S, S, arg1.c_str(), arg2.c_str());
#undef MAKE
да что вы знаете о форматировании.
0
// Define the man site module
define(function(require) {
// Require function that runs when button is clicked
var run = require('./run').run;
// Where the application starts its work
var genTextButton = document.getElementById("button-gen-text");
genTextButton.onclick = run;
});
define(function(require) {
// Require value error
var ValueError = require('./errors/value_errors').ValueError;
// Require EmptyListError
var EmptyListError = require('./errors/property_errors').EmptyListError;
// Require functions that returns data for text generation
var getData = require('./utils/get_data');
var getTextLength = getData.getTextLength;
var getTemplateList = getData.getTemplateList;
var getWordList = getData.getWordList;
var getStyleOption = getData.getStyleOption;
// Require function for setting output text
var makeText = require('./utils/set_text');
// Require function for validating form and validate form
var validateForm = require('./utils/validateForm');
validateForm({
formId : 'form-text-gen',
inputErrorClass : 'input-error',
formInvalidClass : 'form-invalid'
});
// Runs tasks for text generation
var run = function() {
try {
var textLength = getTextLength();
var templateList = getTemplateList();
var wordList = getWordList();
var styleOption = getStyleOption();
makeText({
styleOption : styleOption,
textLength : textLength,
templateList : templateList,
wordList : wordList
});
} catch (error) {
if (error instanceof ValueError) {
console.log(error.stack);
} else if (error instanceof EmptyListError) {
console.log(error.stack);
} else {
throw error;
}
}
}
return {
run : run
}
});
Божественная кнопка
+1
private List<CellControl[]> ComposeLines(List<CellControl[]> vertical, List<CellControl[]> horizontal)
{
List<CellControl[]> result = new List<CellControl[]>();
foreach (var vLine in vertical)
{
var cellsCount = vLine.Length;
List<CellControl[]> linesToCompose = new List<CellControl[]>();
foreach (var vCell in vLine)
{
foreach (var hLine in horizontal)
{
foreach (var hCell in hLine)
{
if (hCell.X == vCell.X && hCell.Y == vCell.Y)
{
linesToCompose.Add(hLine);
cellsCount += hLine.Length;
break;
}
}
if (linesToCompose.Count == 0)
{
result.Add(hLine);
}
}
}
if (linesToCompose.Count == 0)
{
result.Add(vLine);
}
else
{
linesToCompose.Add(vLine);
var newLine = new CellControl[cellsCount];
var i = 0;
foreach (var line in linesToCompose)
{
foreach (var cellControl in line)
{
newLine[i] = cellControl;
cellControl.Selected = true;
i++;
}
}
result.Add(newLine);
}
}
return result;
}
+1
using System;
namespace MainNamespace
{
class MainClass
{
static string str, sep;
static void Sep()
{
int k = 0;
while (k < str.Length * 2 - 5)
{
if (sep.Length * (k + 1) > str.Length * 2 - 5)
break;
Console.Write(sep);
k++;
}
for (int l = 0; l < ((str.Length * 2 - 5) - (k * sep.Length)) ; l++)
Console.Write(sep[l]);
}
static void Main(string[] args)
{
Console.Write("str: ");
str = Console.ReadLine();
Console.Write("sep: ");
sep = Console.ReadLine();
for (int i = 0; i < str.Length-1; i++)
Console.Write(str[i] + " ");
Console.Write(str[str.Length-1] + "\n\n");
for (int j = 0; j < str.Length - 2; j++)
{
Console.Write(str[j + 1] + " ");
Sep();
Console.WriteLine(" " + str[str.Length - j - 2]);
Console.Write(" ");
if(j < str.Length - 3)
{
Sep();
Console.WriteLine(" ");
continue;
}
Console.WriteLine();
}
for (int m = str.Length-1; m >= 1; m--)
Console.Write(str[m] + " ");
Console.WriteLine(str[0]);
Console.ReadKey();
}
}
}
Переписал код http://govnokod.ru/27324 на Шарп с небольшими улучшениями.
0
-define(snk_int_match_arg(ARG),
fun(__SnkArg) ->
case __SnkArg of
ARG -> true;
_ -> false
end
end).
-define(snk_int_match_arg2(M1, M2, GUARD),
fun(__SnkArg1, __SnkArg2) ->
case __SnkArg1 of
M1 ->
case __SnkArg2 of
M2 -> (GUARD);
_ -> false
end;
_ -> false
end
end).
....
-spec maybe_delay(map()) -> ok.
maybe_delay(Event) ->
[{_, Delays}] = ets:lookup(?DELAY_TAB, ?SINGLETON_KEY),
[snabbkaffe_collector:block_until( fun(WU) -> ContP(Event, WU) end
, infinity
, infinity
)
|| #delay{ continue_predicate = ContP
, delay_predicate = DelayP
} <- Delays, DelayP(Event)],
ok.
Наметушил.
0
if @OWNER_PHONE <> @OLD_PHONE set @PHONE = @OWNER_PHONE
if @PHONE <> @OLD_PHONE set @OWNER_PHONE = @PHONE
set @PHONE = @OWNER_PHONE
−1
<?php
header ('Access-Control-Allow-Origin: *');//Разрешили кроссдоменные запросы
$mysql_host = "хост";
$mysql_database = "Бд";
$mysql_user = "Юзернейм";
$mysql_password = "пОроль";
$link = mysql_connect($mysql_host, $mysql_user, $mysql_password) or die("Ошибка при подключении MySQL" );
mysql_select_db($mysql_database, $link) or die ('Ошибка при подключении к БД');
if (isset($_POST['login'])) { $login = $_POST['login']; if ($login == '') { unset($login);} }
if (isset($_POST['password'])) { $password=$_POST['password']; if ($password =='') { unset($password);} }
if (isset($_POST['email'])) { $email=$_POST['email']; if ($email =='') { unset($email);} }
if (isset($_POST['silvercoin'])) { $silvercoin=$_POST['silvercoin']; if ($silvercoin =='') { unset($silvercoin);} }
if (isset($_POST['goldcoin'])) { $goldcoin=$_POST['goldcoin']; if ($goldcoin =='') { unset($goldcoin);} }
if (empty($login) or empty($password) or empty($email))
{
echo ("Вы ввели не всю информацию, заполните все поля!");
exit();
}
$login = stripslashes($login);
$login = htmlspecialchars($login);
$password = stripslashes($password);
$password = htmlspecialchars($password);
$email = stripslashes($email);
$email = htmlspecialchars($email);
$silvercoin = stripslashes($silvercoin);
$silvercoin = htmlspecialchars($silvercoin);
$goldcoin = stripslashes($goldcoin);
$goldcoin = htmlspecialchars($goldcoin);
$login = trim($login);
$password = trim($password);
$email = trim($email);
$silvercoin = trim($silvercoin);
$goldcoin = trim($goldcoin);
$q1 = mysql_query("SELECT login FROM `accounts` WHERE `login`='".$login."'");
$loginb = mysql_fetch_array($q1);
$loginbd=$loginb['login'];
if($loginbd == $login){
echo("Извините, введённый вами логин уже зарегистрирован.");
exit();
}
else
$result2 = mysql_query ("INSERT INTO accounts (login,password,email) VALUES('$login','$password','$email')");
if ($result2=='TRUE')
{
echo "Вы успешно зарегистрированы!";
}
else {
echo "Ошибка! Вы не зарегистрированы.";
}
?>
Использование бредо-заголовок в 2 строке
Использование Инструмента в 2к21, который в PHP5.5.0 20 июня 2013 Объявлен как устаревший, а в PHP 7.0.0 удален
Нет задающей кодировки подключения к БД
Глупая, дешевая валидация данных начиная с 12 и заканчивая 46 строкой
SQL-injection привет!
46 строка - невероятно проверять boolean тип
37 - 39 строка - юзер не найден - лови ошибку!
Чуть не забыл... скрипт не в кодировке UTF-8 no BOM
https://php.ru/forum/threads/pomogite-ispravit-oshibku-cannot-modify-header-information-headers-already-sent-by.90359/
Привет 2010 году !