- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
#ifdef TYPE_A
#define LEN 10
#else
#define LEN_9 9
#endif
#ifdef TYPE_A
char str[LEN + 20];
#else
char str[LEN_9 + 20];
#endif
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+144.1
#ifdef TYPE_A
#define LEN 10
#else
#define LEN_9 9
#endif
#ifdef TYPE_A
char str[LEN + 20];
#else
char str[LEN_9 + 20];
#endif
Макросня
+185
define('KEY', md5('Obama'));
if($_GET['key'] != KEY) {
...
}
таки обамосекьюрность))
встретилось в одном большом проекте, который успешно работает и процветает по сей день
+139.5
#include <iostream>
#include <deque>
#include <time.h>
using namespace std;
int arr[10][10] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 4, 0, 0, 0, 0, 0, 0, 0, 0,
0, 4, 0, 0, 0, 0, 0, 0, 0, 0,
0, 4, 0, 0, 0, 0, 0, 0, 0, 0,
0, 4, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
#define SHIPS 1
struct point{
int x, y;
};
int num = -1, count = 0;
deque<point> ship;
int way[] = {0, 0, 0, 0};
void step(){
for (int i = 0; i < 10; i++){
for (int j = 0; j < 10; j++)
cout << arr[i][j] << ' ' ;
cout << '\n';
}
cout << '\n';
if (num == ship.size()){
memset(way, 0, sizeof(way));
while(!ship.empty()){
arr[ship.front().x + 1][ship.front().y] = 7;
arr[ship.front().x + 1][ship.front().y + 1] = 7;
arr[ship.front().x][ship.front().y + 1] = 7;
arr[ship.front().x + 1][ship.front().y - 1] = 7;
arr[ship.front().x - 1][ship.front().y + 1] = 7;
arr[ship.front().x - 1][ship.front().y - 1] = 7;
arr[ship.front().x][ship.front().y - 1] = 7;
arr[ship.front().x - 1][ship.front().y] = 7;
ship.pop_front();
}
count++;
if (count == SHIPS) {
cout << "Win" << '\n';
exit(0);
}
cout << num << " was killed" << '\n';
num = -1;
}
int x, y;
point tmp;
if (ship.empty()){
x = rand()%10;
y = rand()%10;
while (arr[x][y] == 7){
x = rand()%10;
y = rand()%10;
}
if (arr[x][y] != 0 && arr[x][y] != 7){
num = arr[x][y];
tmp.x = x;
tmp.y = y;
ship.push_front(tmp);
arr[x][y] = 7;
if (x > 0) if (arr[x][y - 1] != 7) way[0] = 1;
if (y > 0) if (arr[x - 1][y] != 7) way[1] = 1;
if (x < 9) if (arr[x][y + 1] != 7) way[2] = 1;
if (y < 9) if (arr[x + 1][y] != 7) way[3] = 1;
step();
}else{
arr[x][y] = 7;
return;
}
}else{
int t = rand()%4;
while (way[t] == 0){
t = rand()%4;
}
switch(t){
case 0:
x = ship.back().x;
y = ship.back().y - 1;
if(arr[x][y] == num){
way[1] = 0;
way[3] = 0;
tmp.x = x;
tmp.y = y;
ship.push_back(tmp);
arr[x][y] = 7;
step();
}else{
arr[x][y] = 7;
way[0] = 0;
return;
}
Морской бой
+157.3
// Строки 8-12. Строковые константы - для мудаков, аффтар гарантирует это!
$simb_r=chr("92").chr("114");
$simb_n=chr("92").chr("110");
$simb_http="http:".chr("47").chr("47");
$simb_ss=chr("47").chr("47");
$r6=chr("35").chr("35").chr("35").chr("35").chr("35").chr("35");
// Строки 20-24. for - для мудаков, копипасту в массы!
$ses[0]=trim($ses[0]);
$ses[1]=trim($ses[1]);
$ses[2]=trim($ses[2]);
$ses[3]=trim($ses[3]);
$ses[4]=trim($ses[4]);
// 50-58. Да здравствует пафос и на хуй не нужное использование тормозных
// POSIX-регэкспов.
for ($i=0; $i < count($_bazadied['browser']); $i++) {
if (eregi($_bazadied['browser'][$i],$_SERVER['HTTP_USER_AGENT'])) exit("Only for peoples!");
}
for ($i=0; $i < count($_bazadied['ip']); $i++) {
if (eregi($_bazadied['ip'][$i],$_SERVER['REMOTE_ADDR'])) exit("IP ban!!!");
}
for ($i=0; $i < count($_bazadied['host']); $i++) {
if($_SERVER['HTTP_REFERER']==true){if (eregi($_bazadied['host'][$i],$_SERVER['HTTP_REFERER'])) exit("HOST ban!!!");}
}
// 135-142. Тернарные? Да идите вы со своими тернарными, и со switch тоже...
if($kak=="first")
{
$text[0]=strtr($text[0],$rubot,$rutop);
}
if($kak=="bot")
{
$text[0]=strtr($text[0],$rutop,$rubot);
}
// 169-170. file_get_contents() - для мудаков.
$fpp=fopen("data.html", "r");
$fulldata=fread($fpp,filesize("data.html")); fclose($fpp);
// 358. Опять же, шли бы вы со своими тернарными...
$temp=false; if(file_exists($dlb.".txt")==true){$temp=true;} if($dlb==$mylicense){$temp=true;}
// 429-437. Брутально.
if($_FILES['addfile']['tmp_name']==true &&
(strrchr($_FILES['addfile']['tmp_name'],'.jpg')==true
|| strrchr($_FILES['addfile']['tmp_name'],'.jpeg')==true
|| strrchr($_FILES['addfile']['tmp_name'],'.gif')==true
|| strrchr($_FILES['addfile']['tmp_name'],'.png')==true
|| strrchr($_FILES['addfile']['name'],'.jpg')==true
|| strrchr($_FILES['addfile']['name'],'.jpeg')==true
|| strrchr($_FILES['addfile']['name'],'.gif')==true
|| strrchr($_FILES['addfile']['name'],'.png')==true))
// 479-500. Аффтар так любит копипасту и ненавидит циклы и file_put_contents()...
if($_POST['event']=="registry"
&& $_POST['sendname']!=$adminlogin
&& $_POST['sendfio']!=$adminname)
{
if($_POST['sendkod']==$_POST['sendtrue']
&& $_POST['sendname']==true
&& $_POST['sendpass']==true
&& $_POST['sendfio']==true
&& eregi("^[_.0-9a-z-]+@([0-9a-z][0-9a-z-]+.)+[a-z]{2,4}$", $_POST['sendemail'])
&& $newuser=="yes"
&& file_exists("data/users/".$_POST['sendname'].".txt")==false)
{
$fop=fopen("data/users/".$_POST['sendname'].".txt", "a+");fputs($fop, "user\r\n"); fclose($fop);
$fop=fopen("data/users/".$_POST['sendname'].".txt", "a+");fputs($fop, $_POST['sendname']."\r\n"); fclose($fop);
$fop=fopen("data/users/".$_POST['sendname'].".txt", "a+");fputs($fop, $_POST['sendpass']."\r\n"); fclose($fop);
$fop=fopen("data/users/".$_POST['sendname'].".txt", "a+");fputs($fop, $_POST['sendfio']."\r\n"); fclose($fop);
$fop=fopen("data/users/".$_POST['sendname'].".txt", "a+");fputs($fop, $_POST['sendemail']."\r\n"); fclose($fop);
$_GET['event']='ok';$_GET['zapros']=$startpage;
}
else{$_GET['event']='error';$_GET['zapros']=$r6;}
$kod=0; $koduri=0;
}
// 735-744. Даёшь копипасту в массы!
$telo=str_replace(" ".$tempik[1]." "," <a href=".$tempik[0].">".$tempik[1]."</a> ",$telo);
$telo=str_replace(" ".$tempik[1].","," <a href=".$tempik[0].">".$tempik[1]."</a>,",$telo);
$telo=str_replace(" ".$tempik[1]."."," <a href=".$tempik[0].">".$tempik[1]."</a>.",$telo);
$telo=str_replace(" ".$tempik[1]."!"," <a href=".$tempik[0].">".$tempik[1]."</a>!",$telo);
$telo=str_replace(" ".$tempik[1]."?"," <a href=".$tempik[0].">".$tempik[1]."</a>?",$telo);
$telo=str_replace(" ".bukvaru($tempik[1],"bot")." "," <a href=".$tempik[0].">".bukvaru($tempik[1],"bot")."</a> ",$telo);
$telo=str_replace(" ".bukvaru($tempik[1],"bot").","," <a href=".$tempik[0].">".bukvaru($tempik[1],"bot")."</a>,",$telo);
$telo=str_replace(" ".bukvaru($tempik[1],"bot")."."," <a href=".$tempik[0].">".bukvaru($tempik[1],"bot")."</a>.",$telo);
$telo=str_replace(" ".bukvaru($tempik[1],"bot")."!"," <a href=".$tempik[0].">".bukvaru($tempik[1],"bot")."</a>!",$telo);
$telo=str_replace(" ".bukvaru($tempik[1],"bot")."?"," <a href=".$tempik[0].">".bukvaru($tempik[1],"bot")."</a>?",$telo);
// 805-808 не влезло, там подряд четыре if'а с одинаковыми условиями...
То, за что глаз уцепился при беглом чтении файла index.php CMS RumbaEasy версии 2.4 (http://rumba.net.ru/easy/skachat.html). Советую скачать оригинал и почитать - оно того стоит. А уж как пафосно она разрекламирована авторами (http://rumba.net.ru/easy/)...
З.Ы. Аффтары, если вы это читаете - извините, не имею ничего против вас лично, но, по-моему, самое место вашей разработке здесь.
+143
define ('bg_color', 'FFFFFF');
define ('border_color', 'AAAAAA');
define ('over_color', 'f4f4f4');
define ('th_color', 'e4e4e4');
CSS 4.0
+146
<?php
$link="http://cert.vatsim.net/cert/vatsimnet/idstatus.php?cid=111111";
$contents = file_get_contents($link);
if ($contents!=FALSE) {
$xml = simplexml_load_string($contents);
$output = "<code>".$contents."</code><br>LAST NAME: ".$xml->user->name_last;
$output.="<br>EMAIL: ".$xml->user->email;
return $output;
}
else {
return "FAILED";
}
?>
Парсерчег XML статов из сети ВАТСИМ
+139.1
$mem=f(qs("max(id)+1 as nextid from members "));
$mid=$mem[nextid];
$sql="`members` ( `id`, `login` , `pswd` , `fname` , `lname` , `email` , `street` , `city` , `state` , `country` , `zip` , `phone` , `fax` , `status` , `rdate` ) VALUES ( '$mid', '$login', '$pswd_1', '$fname', '$lname', '$email', '$street', '$city', '$state', '$country', '$zip', '$phone', '$fax', '$mem_default_approval', '$dt1')";
qi($sql);
Вместо auto_increment индекс можно определить вот таким вод способом)))
+133.3
setlocale(0,"");
int x;
cin >> x;
if(x > 10 && x < 0)
{
cout << "Неверный множытель!" << endl;
}
else
{
//...
}
А, я ещё удивлялса, почемуже она работает не так как надо)))
+175.3
for(i=0;i<3;i++)
{
pictures[i] = new Image()
if(i==0) pictures[i].src = "jpg/javascript/3.jpg"
if(i==1) pictures[i].src = "jpg/javascript/2.jpg"
if(i==2) pictures[i].src = "jpg/javascript/1.jpg"
}
http://citforum.ru/internet/javascript/exgraph.shtml
+124.6
#define Yield()
winbase.h , строка 57.
В Windows SDK, даже новом от Windows 7, присутствует заглушка для функции от Windows 3.x (1992 год). Эта заглушка мешает называть свои методы "Yield", никакой пользы при этом не принося - код от 3.х не дожил до этого года без изменений.