- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
/**
* @param $password
* @return bool
*/
public function validatePassword($password)
{
return (strcmp($password, $this->getPassword() === 0));
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+166
/**
* @param $password
* @return bool
*/
public function validatePassword($password)
{
return (strcmp($password, $this->getPassword() === 0));
}
+158
<?php
//ключ для xxtea
$sekret = mt_rand(1,99999999999999);
//фальшыфка для get :D пускай тру хакеры помучаются пару недель :D
$sol = mt_rand (1, 9999999);
$iid = mt_rand (1, 900);
$iid = md5($sol.$iid.sha1($sekret.$iid).md5($sol.$iid));
$dan = base64_encode($iid);
$dan = md5($sol.$iid.$dan.sha1($sekret.$iid.$dan).md5($sekret.$iid.$dan));
//шифровка ключа который делает розшыфровку :D знаю что так надёжние :D :D
$pi = mt_rand (1, 5);
$delitil = mt_rand (1, 10);
$mnogitel = mt_rand (1, 15);
$dodan = mt_rand (1, 20);
$mn = mt_rand (1, 25);
$mn1 = mt_rand (1, 50);
$procent = mt_rand (1, 5);
$procent= $sekret / $procent;
$sekret = $sekret * $mn / $pi;
$pq = $sekret / $delitil;
$pw = $pq /$procent;
$output = $pw * $mnogitel ;
$otv = $output + $dodan * $mn1;
//розшыфровка ключа
$otv = $output / $mn1 - $dodan;
$sekret =$output * $procent * $delitil / $mnogitel /$mn * $pi;
https://toster.ru/q/204286
+136
printf("Enter item code: "); //Prompts user
scanf ("%14s", codenew1); //Read user input
len = strlen(codenew1); //Read each character into variable len
while (len != strspn(codenew1, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"))
{
printf ("Name contains non-alphabet characters. Try again!: "); //Prompts user to try again
scanf ("%14s", codenew1); //Reads user input
len = strlen(codenew1); //Read each character into variable len
} //Endwhile
strncpy(codenew, codenew1,2); //Copy the first two characters from the variable codenew1
codenew[2] = 0; //Store first two characters into variavle codenew
for ( j = 0; j < num_items; j++) //Loop for num_items times
{ //Beginning of for loop
if (strcmp(array[j].code1, codenew) == 0) //If codenew is found in file
{ //Beginning of if statement
price[i] = item_qty[i] * array[j].price1; //Calculating the price of an item
printf("Price : %d", price[i]); //Prints price
printf("\nEnter '%s' to confirm: ", array[j].itemname1); //Confirming the item
scanf("%19s", item_name1[i]);
while (strcmp(item_name1[i], array[j].itemname1 )!=0) //Looping until both item names are the same
{ //Begin while loop
printf("Item name is not %s ,Try Again!: ", array[j].itemname1); //Prompt user to try again
scanf ("%19s", item_name1[i]); //Reads item name into an array
len = strlen(item_name1[i]); //Reads each character into variable len
} //End while loop
len = strlen(item_name1[i]); //Read each character into variable len
while (len != strspn(item_name1[i], "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")) //While len contains non alphabetic characters
{ //Beginning while
printf ("Name contains non-alphabet characters. Try again!: "); //Prompts user to try again
scanf ("%19s", item_name1[i]); //Read user input
len = strlen(item_name1[i]); //Read each character into variable len
} //End while
strncpy(item_name[i], item_name1[i], 20); //Copy the first two characters from the variable codenew1
item_name[i][20] = 0; //Store first 20 characters in variable item_name[i]
total_price+= price[i]; //Calculate total price
break; //Terminates loop
} //End of if statement
else
if (strcmp(array[j].code1, codenew) != 0) //If codenew is found in file
{
printf("Invalid input! Try again.");
goto Here;
}
} //End of for loop
Бесценные комментарии!
http://stackoverflow.com/questions/29045067/error-check-files
−119
функция КрасиваяДата ( Дата )
Стр = "";
Д = День (Дата);
М = Месяц (Дата);
Г = Год (Дата);
Если М = 1 тогда
мес = "января";
ИначеЕсли М = 2 тогда
мес = "февраля";
ИначеЕсли М = 3 Тогда
мес = "марта";
ИначеЕсли М = 4 Тогда
мес = "апреля";
ИначеЕсли М = 5 Тогда
мес = "майя";
ИначеЕсли М = 6 Тогда
мес = "июня";
ИначеЕсли М = 7 Тогда
мес = "июля";
ИначеЕсли М = 8 Тогда
мес = "августа" ;
ИначеЕсли М = 9 Тогда
мес = "сентебря";
ИначеЕсли М = 10 Тогда
мес = "октебря";
ИначеЕсли М =11 Тогда
мес = "ноября";
ИначеЕсли М =12 Тогда
мес = "декобря";
КонецЕсли;
КДата = Строка (Д) + " " + мес + " " + Строка(Г) + " г.";
Возврат КДата;
КонецФункции
Встретил сегодня такую конструкцию в отчете. Орфография передана без изменения
+114
CFG ; start: scasb
DCG ; salc
AEEAFF ; and al,'\'-'/'
AAEAFO ; add al,'/'
DBFAFB ; int 29h
DFDDGG ; jmp start
Генератор лабиринта на Wct.
+59
#include <stdio.h>
#include <stdlib.h>
int main()
{
FILE *fp;
char hc1,hc2,mc1,mc2;
int hi1,hi2,mi1,mi2,hour,minute;
system("echo %time% >time.txt");
fp=fopen("time.txt","r");
if(fp==NULL)
exit(1) ;
hc1=fgetc(fp);
hc2=fgetc(fp);
fgetc(fp);
mc1=fgetc(fp);
mc2=fgetc(fp);
fclose(fp);
remove("time.txt");
hi1=hc1;
hi2=hc2;
mi1=mc1;
mi2=mc2;
hi1-=48;
hi2-=48;
mi1-=48;
mi2-=48;
hour=hi1*10+hi2;
minute=mi1*10+mi2;
printf("Current time is %d:%d\n",hour,minute);
return 0;
}
Как узнать текущее время особо извращенным образом. http://stackoverflow.com/questions/5141960/get-the-current-time-in-c
+55
On Wed, 29 Oct 2014 20:29:33 +0000
via Digitalmars-d <[email protected]> wrote:
> On Wednesday, 29 October 2014 at 20:13:34 UTC, ketmar via
> Digitalmars-d wrote:
> > On Wed, 29 Oct 2014 13:07:38 -0700
> > Walter Bright via Digitalmars-d <[email protected]>
> > wrote:
> >
> >> There are still two string types, something you can't quite
> >> escape dealing with.
> > and D has three string types. it's even better than C++!
>
> Only three? C++ has seven:
>
> 1. const char* /* zero terminated single byte*/
> 2. const char* /* zero terminated multi byte */
> 3. const wchar_t* /* zero terminated wide */
> 4. std::string
> 5. std::wstring
> 6. std::u16string
> 7. std::u32string
ah, D has those 'char*' family too, but i don't count them as string
types. ok, C++ wins. again. ;-)
Хоть и не код, но смешно.
Источник: http://forum.dlang.org/thread/[email protected]?page=3
+166
function chekemailandpas(e) {
var email1val = $('#email1').val();
var pas1val = $('#password1').val();
var name1val = $('#name1').val();
var famil2val = $('#famil2').val();
name1val = del_spaces(name1val);
famil2val = del_spaces(famil2val);
email1val = del_spaces(email1val);
pas1val = del_spaces(pas1val);
email1 = email1val.length;
pas1 = pas1val.length;
if(!e) {
e = event || window.event;
}
if(e == '[object MouseEvent]' || e.keyCode == 13 && email1val !== '' && pas1val !== '') {
if(email1 < 5) {
setTimeout(function() {
$('#email1').css('background', 'rgba(240,128,128, 0.1)');
setTimeout(function() {
$('#email1').css('background', 'rgba(240,128,128,0.2)');
setTimeout(function() {
$('#email1').css('background', 'rgba(240,128,128,0.3)');
setTimeout(function() {
$('#email1').css('background', 'rgba(240,128,128,0.4)');
setTimeout(function() {
$('#email1').css('background', 'rgba(240,128,128,0.5)');
}, 50);
}, 50);
}, 50);
}, 50);
}, 500);
if($('#email1').css('background', 'rgba(240,128,128,0.5)')) {
setTimeout(function() {
$('#email1').css('background', 'rgba(240,128,128, 0.4)');
setTimeout(function() {
$('#email1').css('background', 'rgba(240,128,128,0.3)');
setTimeout(function() {
$('#email1').css('background', 'rgba(240,128,128,0.2)');
setTimeout(function() {
$('#email1').css('background', 'rgba(240,128,128,0.1)');
setTimeout(function() {
$('#email1').css('background', 'rgba(240,128,128,0.0)');
}, 50);
}, 50);
}, 50);
}, 50);
}, 500);
}
}
if(pas1 < 2) {
setTimeout(function() {
$('#password1').css('background', 'rgba(240,128,128, 0.1)');
setTimeout(function() {
$('#password1').css('background', 'rgba(240,128,128,0.2)');
setTimeout(function() {
$('#password1').css('background', 'rgba(240,128,128,0.3)');
setTimeout(function() {
$('#password1').css('background', 'rgba(240,128,128,0.4)');
setTimeout(function() {
$('#password1').css('background', 'rgba(240,128,128,0.5)');
}, 50);
}, 50);
}, 50);
}, 50);
}, 500);
if($('#password1').css('background', 'rgba(240,128,128,0.5)')) {
setTimeout(function() {
$('#password1').css('background', 'rgba(240,128,128, 0.4)');
setTimeout(function() {
$('#password1').css('background', 'rgba(240,128,128,0.3)');
setTimeout(function() {
$('#password1').css('background', 'rgba(240,128,128,0.2)');
setTimeout(function() {
$('#password1').css('background', 'rgba(240,128,128,0.1)');
setTimeout(function() {
$('#password1').css('background', 'rgba(240,128,128,0.0)');
}, 50);
}, 50);
}, 50);
}, 50);
}, 500);
}
}
if(email1 > 4 && pas1 > 1) {
var pagename = 'email='+email1val+'&password='+pas1val+'&name='+name1val+'&famil='+famil2val;
sendRequest(pagename);
}
}
}
+140
type func = function (x : real) : real;
const
eps = 0.0000003;
pi = 3.14159265358979;
function Integral (f : func; a, b : real) : real;
var center : real;
begin
center := (a + b) / 2;
if abs(b - a) < eps then
Integral := f(center) * (b - a)
else Integral := Integral(f, a, center) +
Integral(f, center, b);
end;
function myFunc(x : real) : real;
begin
myFunc := cos(x) / x;
end;
begin
writeln(Integral(myFunc, pi/2, pi));
readln;
end.
Толи я дурачек, толи автор кода - школьник....
+64
int i;
кода на самом деле нет, но это достойно говнокод.ру
на сервере был http метод GET /rest/user/anon/create
по непонятной причине был заменён на POST /rest/user/anon/create1
старый метод теперь возвращает 405 ошибку "Method not allowed" с заголовком Allow: POST, OPTIONS