-
Лучший говнокод
- В номинации:
-
- За время:
-
-
+150.8
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
$result_row = $db->query("SELECT DISTINCT good_vars.coef_value, good_vars.coef_type ... ");
$row = $db->fetch_array($result_row);
$coef_type = $row['coef_type'];
$coef_value = $row['coef_value'];
$array = explode(',', ($coef_type.','.$coef_value));
$result = 0;
if ($array[0] == 2) {
$result = $price * $array[1] / 100;
} elseif ($array[0] == 3) {
$result = $array[1];
}
ох уж эти студенты...
wasa,
08 Декабря 2009
-
+158.2
- 1
- 2
- 3
if(empty($_SESSION['login'])) {
die("<script>top.location.href='index.php';</script>");
}
dicos,
03 Декабря 2009
-
+71.7
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
//это метод
public Integer getNoDeletedSubscribers() {
Integer count = 0;
for (int i = 0, n = subscribers.size(); i < n; count += (!subscribers.get(i++).isDeleted() ? 1 : 0));
return count;
}
//а вот пример использования этого метода в коде))
private void actionValidateInput() {
saveTaskBtn.setEnabled(!(((taskName.getText().equals("") ||
subscriberBox.getSelectedItem()==null ||
f51Box.getSelectedItem()==null || getTask().getNoDeletedSubscribers()==0 ) && getTask().getTaskType()==TaskType.SEND_MAIL) ||
((taskName.getText().equals("") && getTask().getTaskType()==TaskType.RECIVE_MAIL))));
}
кусочек мазгоразрывающей логики
nicolas.patsevich,
01 Декабря 2009
-
+159.4
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
<?php
//#main.php
//Инициализация скрипта
....
$a=10;
$setadmin=0;
$Check=_GET['admincheck']/0; //Dark, !!не трогай!!, !!оно работает!!
if ($Check==0) {
ban_usr($a,$cu_ipad);
die('You are not administrator:banned for ten minutes...');
}else{
getusrrg($setadmin,$cu);
set_access($setadmin,$cu_ipadб,$cu,$c_time);
}
....
скрипт был написан моим другом пол года назад
похоже тогда он знал что я в него залезу
darksvesh,
29 Ноября 2009
-
+156.8
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
#topBlock
<script language="JavaScript">
function process(){}
today = new Date()
if((today.getHours() < 12) && (today.getHours() >= 6)) {background:url('http://site/1.png') top center no-repeat;height:243px;}
if((today.getHours() >= 12) && (today.getHours() < 18)) {background:url('http://site/2.png') top center no-repeat;height:243px;}
if((today.getHours() >= 18) && (today.getHours() <= 23)) {background:url('http://site/3.png') top center no-repeat;height:243px;}
if((today.getHours() >= 0) && (today.getHours() < 6)) {background:url('http://site/4.png') top center no-repeat;height:243px;}
</script>
#tobTable.... ну и дальше неважно
Отчаянная попытка сделать логотип, сменяющий цвет в зависимости от времени суток =) Как выяснилос, поциент вставлял это в CSS. http://helper.ucoz.ru/forum/20-6633
fuckyounoob,
25 Ноября 2009
-
+160.4
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
<?php
// ...
$vars = get_class_vars($class_name);
if(is_array($vars)) {
foreach($vars as $var => $val) {
eval('$this->' . $var . ' = \'' . $val . '\';');
}
}
некакая UNI-CMS
это не самое худшее. что я там нашел ... в общем мрак... (
nicolay-punin,
22 Ноября 2009
-
+98.6
- 1
private bool IsNamesAreEqual(string itemName, string nodeName) { ... }
Правда это скорее относится к английскому языку, нежели к шарпу.
Иногда полезно перечитывать давно написаный код, много нового узнаешь )))
plsc_rover,
20 Ноября 2009
-
−864.2
- 1
- 2
- 3
- 4
- 5
select to_char(null) from dual
union
select to_number(null) from dual
ORA-01790: expression must have same datatype as corresponding expression
Когда смотришь на пустую чашку, то можно сказать, что в ней нет, например, чая или ,например, нет кофе. Но нельзя сказать, что в нет ни чая ни кофе.
dim1r,
16 Ноября 2009
-
+164.2
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
while ($rst=mysql_fetch_array($rst_query))
{
$clist.="," . $rst["es_id"];
$thislist="-1," . $rst["es_id"];
while ($rst=mysql_fetch_array($rst_query))
{
$clist.="," . $rst["es_id"];
$thislist.="," . $rst["es_id"];
}
$rst_query=mysql_query("Select * from esb2b_categories where es_pid in (" . $thislist . ")" );
}
разрыв мозга
made by какой-то индус
primpil,
16 Ноября 2009
-
+136.8
- 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
...
// TODO: remove this godless "switch()"!
switch(tuntype) { // TODO: Important: do as in documentation instead of reverse-ingeniering!
#define PACKET_TRY {\
if(packet->ip_v == 4) {\
hl=packet->ip_hl<<2;\
if(hl>=sizeof(*packet))\
break;\
/* TODO: Check in RFC something about of ICMP send-back in this case */\
fprintf(stderr, "Got too short IP-header (%i)...\n",hl);\
}\
if((packet->ip_v&IPV6_VERSION_MASK) == IPV6_VERSION) {\
break;\
}\
}
#define NEXT(a) tuntype=a;\
if(tuntry>=2)\
goto tun_process_switch_end;\
tuntry++;
#define CASE(a) NEXT(a);\
case a
tun_process_switch:
// switch(tuntype) {
case TUNTYPE_NORM: // NetBSD-like?
packet=(typeof(packet))ptr;
PACKET_TRY;
CASE(TUNTYPE_EXT): // FreeBSD-like?
packet=(typeof(packet))((char *)ptr + 4);
if(s>4)
if(*ptr==0x02)
PACKET_TRY;
CASE(TUNTYPE_ETH): // Ethernet? TODO: Implement VLAN-tagging
packet=(typeof(packet))((char *)ptr + sizeof(*eth));
eth=(typeof(eth))ptr;
if(!teth) {
teth=alloca(sizeof(*teth));
memcpy(&teth->ether_shost, ð->ether_dhost, sizeof(teth->ether_shost));
memcpy(&teth->ether_dhost, ð->ether_shost, sizeof(teth->ether_dhost));
teth->ether_type=ETHERTYPE_IP;
}
if(s>sizeof(*eth))
// if((*(char *)ð->ether_type==0x08/* not IPv4? */)||(*(char *)ð->ether_type==0x86/* not IPv6? */)) // TODO: Implement compatibility with all protocols over ethernet
PACKET_TRY;
NEXT(TUNTYPE_NORM);
goto tun_process_switch;
default:
tuntype=TUNTYPE_NORM;
goto tun_process_switch;
// }
tun_process_switch_end:
#undef CASE
#undef NEXT
#undef PACKET_TRY
if(tuntry<~0)
tuntry=0;
tuntype=oldtuntype;
fprintf(stderr, "Got unknown packet. Flushing...\n");
FLUSH; // Flush all. We don't know the length of packet with unknown type.. So, we have to flush the buffer, to probably get new packets from the start.
goto tun_process_while;
}
...
"Ляпотааааа"... Очень "структурный" switch...
xaionaro,
11 Ноября 2009