-
Лучший говнокод
- В номинации:
-
- За время:
-
-
+105
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
procedure TForm2.FormCreate(Sender: TObject);
begin
SpeedButton1.Left := Form2.ClientWidth div 2 - SpeedButton1.Width;
SpeedButton1.Top := Form2.ClientHeight div 2 - SpeedButton1.Height;
SpeedButton2.Left := Form2.ClientWidth div 2;
SpeedButton2.Top := Form2.ClientHeight div 2 - SpeedButton2.Height;
SpeedButton3.Left := Form2.ClientWidth div 2 - SpeedButton3.Width;
SpeedButton3.Top := Form2.ClientHeight div 2;
SpeedButton4.Left := Form2.ClientWidth div 2;
SpeedButton4.Top := Form2.ClientHeight div 2;
end;
Fai,
30 Августа 2011
-
+175
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
function get_user_name($id) {
$query = "
SELECT name
FROM users
WHERE id = '".$id."'
";
$this->registry['sql']->query($query);
if ($this->registry['sql']->getNumberRows()>0) {
$result = $this->registry['sql']->getFetchObject();
return $result[0]->name;
}
}
function get_user_login($id) {
$query = "
SELECT login
FROM users
WHERE id = '".$id."'
";
$this->registry['sql']->query($query);
if ($this->registry['sql']->getNumberRows()>0) {
$result = $this->registry['sql']->getFetchObject();
return $result[0]->login;
}
}
function get_user_password($id) {
$query = "
SELECT password
FROM users
WHERE id = '".$id."'
";
$this->registry['sql']->query($query);
if ($this->registry['sql']->getNumberRows()>0) {
$result = $this->registry['sql']->getFetchObject();
return $result[0]->password;
}
}
function get_user_role($id) {
$query = "
SELECT role
FROM users
WHERE id = '".$id."'
";
$this->registry['sql']->query($query);
if ($this->registry['sql']->getNumberRows()>0) {
$result = $this->registry['sql']->getFetchObject();
return $result[0]->role;
}
}
function get_user_adress($id) {
$query = "
SELECT adress
FROM users
WHERE id = '".$id."'
";
$this->registry['sql']->query($query);
if ($this->registry['sql']->getNumberRows()>0) {
$result = $this->registry['sql']->getFetchObject();
return $result[0]->adress;
}
}
function get_user_valuta($id) {
$query = "
SELECT valuta
FROM users
WHERE id = '".$id."'
";
$this->registry['sql']->query($query);
if ($this->registry['sql']->getNumberRows()>0) {
$result = $this->registry['sql']->getFetchObject();
return $result[0]->valuta;
}
}
function get_room_type($id){
$query = "
SELECT type
FROM rooms
WHERE id = '".$id."'
";
$this->registry['sql']->query($query);
if ($this->registry['sql']->getNumberRows()>0) {
$result = $this->registry['sql']->getFetchObject();
return $result[0]->type;
}
}
в догонку к Говнокод #7684
vkontakte,
29 Августа 2011
-
+167
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
char *sLoop = new char[4];
_itoa(i, sLoop, 10);
string strField = fp1 + sLoop + fp2;
char *str = new char[255];
for (int i=0; i<=sizeof(strField); i++)
str[i] = strField[i];
_bstr_t impFieldName(str);
// думаю, очевдно, что delete нигде не было. ;)
Говногость,
25 Августа 2011
-
+73
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
if(block == Block.blockDiamond || block == Block.oreDiamond)
{
return toolMaterial.getHarvestLevel() >= 2;
}
if(block == Block.blockGold || block == Block.oreGold)
{
return toolMaterial.getHarvestLevel() >= 2;
}
if(block == Block.blockSteel || block == Block.oreIron)
{
return toolMaterial.getHarvestLevel() >= 1;
}
if(block == Block.blockLapis || block == Block.oreLapis)
{
return toolMaterial.getHarvestLevel() >= 1;
}
if(block == Block.oreRedstone || block == Block.oreRedstoneGlowing)
{
return toolMaterial.getHarvestLevel() >= 2;
}
Из сорцов майнсрафта.
Нахрена делать из двух ifов пять?!
RaZeR,
19 Августа 2011
-
−117
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
// Здесь примерно еще примерно 50 условий
if (event.keyCode == 188)
{
my_answer[pos_text] = "Б";
pos_text = pos_text + 1;
}
if (event.keyCode == 190)
{
my_answer[pos_text] = "Ю";
pos_text = pos_text + 1;
}
Маленький кусочек говнокода..
KirAmp,
16 Августа 2011
-
+159
- 1
Наконец-то http://goo.gl/SjgUj
absolut,
13 Августа 2011
-
+147
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
<script type="text/javascript" >
var str = window.location + "";
var t = str.substr(7, 2);
if (t=="40") {document.write("(4842)<span style=\"font-size:30px;font-weight:bold;color:white;\">562–003</span>");}
if (t=="36") {document.write("(473)<span style=\"font-size:30px;font-weight:bold;color:white;\">233-03-20</span>");}
if (t=="62") {document.write("(4912)<span style=\"font-size:30px;font-weight:bold;color:white;\">300-305</span>");}
if (t=="ww") {document.write("(4872)<span style=\"font-size:30px;font-weight:bold;color:white;\">39-03-06</span>");}
if (t=="po") {document.write("(4872)<span style=\"font-size:30px;font-weight:bold;color:white;\">39-03-06</span>");}
</script>
<script type="text/javascript" >
var str = window.location + "";
var t = str.substr(7, 2);
if (t=="40") {document.write("Калуга");}
if (t=="36") {document.write("Воронеж");}
if (t=="62") {document.write("Рязань");}
if (t=="ww") {document.write("Тула");}
if (t=="po") {document.write("Тула");}
</script>
Вот так упыри меняют телефоны на сайте в зависимости от региона, при том, что сайт использует PHP на сервере.
demitriy_,
12 Августа 2011
-
+144
- 1
<head> <body bgcolor="00FF00"></head>
прислали в вопросом "будет ли работать" :)
viktore4ka,
12 Августа 2011
-
+165
- 1
- 2
foreach ($_POST as $kp => $post)
$_POST2[$kp] = $post;
Это написано в самом начале того скрипта, что мне дали фиксить, в коде я встретил строчки описанные выше, а также деление на 0 и неправильно раставленные скобки в условиях с && и ||
DarkThinker,
11 Августа 2011
-
+84
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
search = 0;
try {
search = search + wdContext.currentSearchElement().getLifnr().length();
} catch (Exception ex) {
// ex.printStackTrace();
}
try {
search = search + wdContext.currentSearchElement().getBahns().length();
} catch (Exception ex) {
// ex.printStackTrace();
}
try {
search = search + wdContext.currentSearchElement().getINN().length();
} catch (Exception ex) {
// ex.printStackTrace();
}
try {
search = search + wdContext.currentSearchElement().getKPP().length();
} catch (Exception ex) {
// ex.printStackTrace();
}
try {
search = search + wdContext.currentSearchElement().getKtokk().length();
} catch (Exception ex) {
// ex.printStackTrace();
}
try {
search = search + wdContext.currentSearchElement().getLand1().length();
} catch (Exception ex) {
// ex.printStackTrace();
}
try {
search = search + wdContext.currentSearchElement().getBanks().length();
} catch (Exception e) {
// TODO: handle exception
}
try {
search = search + wdContext.currentSearchElement().getBankl().length();
} catch (Exception ex) {
// TODO: handle exception
}
try {
search = search + wdContext.currentSearchElement().getBankn().length();
} catch (Exception ex) {
// TODO: handle exception
}
try {
search = search + wdContext.currentSearchElement().getLocco().length();
} catch (Exception ex) {
// ex.printStackTrace();
}
try {
// search = search + wdContext.currentSearchElement().getLoevm().length();
search = search + wdContext.currentSearchElement().getName().length();
} catch (Exception ex) {
// ex.printStackTrace();
}
try {
search = search + wdContext.currentSearchElement().getOKPO().length();
} catch (Exception ex) {
// ex.printStackTrace();
}
try {
search = search + wdContext.currentSearchElement().getOrt01().length();
} catch (Exception ex) {
// ex.printStackTrace();
}
try {
search = search + wdContext.currentSearchElement().getSortl().length();
} catch (Exception ex) {
// ex.printStackTrace();
}
if (search == 0)
wdComponentAPI.getMessageManager().reportException("Введите критерии поиска", true);
else {
//Далее идет поиск
}
Вот такой вот была забабахана проверка входных параметров перед вызовом функции поиска (мною добавлен только последний комментарий, все остальное оригинальное)
foGa,
11 Августа 2011