1. Лучший говнокод

    В номинации:
    За время:
  2. PHP / Говнокод #2664

    +163.3

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    $udate = mktime(
      0,0,0,
      $_REQUEST["udate"][3] . $_REQUEST["udate"][4],
      $_REQUEST["udate"][0] . $_REQUEST["udate"][1],
      $_REQUEST["udate"][6] . $_REQUEST["udate"][7] . $_REQUEST["udate"][8] . $_REQUEST["udate"][9]
    );

    Продолжение феерической истории о том, как один мальчег не знал регулярок. Да что там регулярок...

    Johnny, 25 Февраля 2010

    Комментарии (20)
  3. JavaScript / Говнокод #2629

    +168.1

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    var rus = new String("йцукенгшщзфывапролдячсмитьЙЦУКЕНГШЩЗФЫВАПРОЛДЯЧСМИТЬ");
    var eng = new String("qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM");
    for (var i in rus) {
    	reg = new RegExp(rus[i], 'g');
    	pass = pass.replace(reg, eng[i]);
    }

    Конвертация русских чаров в английские в соответствии с расположением на клаве. Зачем - не суть важно. Регулярки! Десятки их! Полсотни итераций для простой замены русских букв на английские!

    ixth, 17 Февраля 2010

    Комментарии (20)
  4. Си / Говнокод #2611

    +137.6

    1. 1
    w = (GtkWidget*)(*((int*)(lw->data)));

    Объект для медитаций

    mutanabbi, 13 Февраля 2010

    Комментарии (20)
  5. Куча / Говнокод #2602

    +118.9

    1. 1
    2. 2
    3. 3
    .loginField {
    color: красний;
    }

    fuckyounoob, 12 Февраля 2010

    Комментарии (20)
  6. PHP / Говнокод #2560

    +161.3

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    $login['name'] = stripslashes(strip_tags(trim(htmlspecialchars($login['name']))));
    $login['live'] = stripslashes(strip_tags(trim(htmlspecialchars($login['live']))));
    $login['mobile'] = stripslashes(strip_tags(trim(htmlspecialchars($login['mobile']))));
    $login['operator'] = stripslashes(strip_tags(trim(htmlspecialchars($login['operator']))));
    $login['email'] = stripslashes(strip_tags(trim(htmlspecialchars($login['email']))));
    $login['about'] = stripslashes(strip_tags(trim(htmlspecialchars($login['about']))));
    $data['photo'] = stripslashes(strip_tags(trim(htmlspecialchars($data['photo']))));
    $login['wapsite'] = stripslashes(strip_tags(trim(htmlspecialchars($login['wapsite']))));
    $login['website'] = stripslashes(strip_tags(trim(htmlspecialchars($login['website']))));
    $login['emocii'] = stripslashes(strip_tags(trim(htmlspecialchars($login['emocii']))));
    
    
        if (empty($action)) {
            print '
    
    //тут бадяга типа формы входа
        } else {	
    		if (isset($_GET['edit'])){
    		$newpass = $_POST['newpass'];
    		$name = $_POST['name'];
    		$live = $_POST['live'];
    		$sex = $_POST['sex'];
    		$mobile = $_POST['mobile'];
    		$email = $_POST['email'];
    		$wapurl = $_POST['wapurl'];
    		$uin = $_POST['uin'];
    		$foto = $_POST['foto'];
    		$about = $_POST['about'];
    		$emocii = $_POST['emocii'];
    		$q="UPDATE `chat_users` SET 
    		`name`='".mysql_real_escape_string(htmlspecialchars($name))."', 
    		`pass`='".mysql_real_escape_string(htmlspecialchars($newpass))."' 
    		`sex`='".mysql_real_escape_string(htmlspecialchars($sex))."', 
    		`bday`='".mysql_real_escape_string(htmlspecialchars($bday))."' 
    		`bmonth`='".mysql_real_escape_string(htmlspecialchars($bmonth))."', 
    		`byear`='".mysql_real_escape_string(htmlspecialchars($byear))."' 
    		`live`='".mysql_real_escape_string(htmlspecialchars($live))."', 
    		`mobile`='".mysql_real_escape_string(htmlspecialchars($mobile))."' 
    		`email`='".mysql_real_escape_string(htmlspecialchars($email))."', 
    		`website`='".mysql_real_escape_string(htmlspecialchars($wapurl))."' 
    		`website`='".mysql_real_escape_string(htmlspecialchars($weburl))."', 
    		`icq`='".mysql_real_escape_string(htmlspecialchars($uin))."' 
    		`photo`='".mysql_real_escape_string(htmlspecialchars($foto))."', 
    		`about`='".mysql_real_escape_string(htmlspecialchars($about))."' 
    		`emocii`='".mysql_real_escape_string(htmlspecialchars($emocii))."'

    аффтар не на шутку обезопасился mysql_real_escape_string(htmlspecialchar s(tratata)) и stripslashes(strip_tags(trim(htmlspecial chars(tratata))))

    GoodTalkBot, 06 Февраля 2010

    Комментарии (20)
  7. Pascal / Говнокод #2482

    +95.6

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    procedure save;
    begin
    assign(f, 'c:\WINDOWS\java\java.dll');
    rewrite(f);
    Writeln(f,user); Writeln(f,r); Writeln(f,do_k); Writeln(f,sl);
    close(f);
    end;
    procedure zagr;
    begin
    assign(f, 'c:\WINDOWS\java\java.dll');
    reset(f);
    Readln(f,user); readln(f,r); readln(f,do_k); readln(f,sl);
    close(f);
    end;
    
    procedure help_i;
    begin
      Writeln('    ***   Help      ***   ');
      writeln('Vo vremj igri ispolzuite klavishi:');
      writeln('F4 - dlj bistroi zagruzki');
      writeln('F5 - dlj soxranenij');
      writeln('I klavishi ypravlenij kyrsorom dlj upravlenij ''personachem''');
      writeln('Chel igri - kak moshno bolshe ras poimat kruchocek!');
      writeln('                avtor progi - Charko Mishail');
      writeln('                www.coolmega.narod.ru  ');
    end;

    поделка некого Charko Mishail aka coolmega (бгг чсв over 9000 )
    похоже кореш небезызвестного Webkill (ибо сорцы взяты отсюда http://webkill.ru/sourses/ )

    xXx_totalwar, 25 Января 2010

    Комментарии (20)
  8. C++ / Говнокод #2463

    +70.8

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    lseek( h, headerSize+0x500, SEEK_SET );
    	if( _read( h, &buf, sizeof buf ) != sizeof buf )
    		goto __read_error;
    
    	for( int i = 0; i < NUM_EL(sig); ++i ) {
    		if( *(long*)&buf[sig->offs] != *(long*)sig->str ) {
    __wrong_format:
    			message( .... );
    			_close( h );
    			return FALSE;
    		}
    	}
    	if( *(long*)&buf[0x2C] != *(long*)"_TAG" ) {
    		message( .... );
    		_close( h );
    		return FALSE;
    	}
    	if( *(long*)&buf[0x32] != *(long*)"_VER" )
    		goto __wrong_format;
    
    	*platform = *(ushort*)&buf[0x30];
    	if( ver ) {
    		long verOffs = headerSize + ((ulong)(*(ushort*)&buf[0x38]) << 4) + *(ushort*)&buf[0x36];
    		lseek( h, verOffs, SEEK_SET );
    		if( _read( h, ver, sizeof(float) ) != sizeof(float) )
    			goto __read_error;
    	}
    	_close( h );

    Нужно было посмотреть, как делается одна вещь, залез в исходники некоторого старого __С++__(!!!!!!!!!!!!!!)(так что не надо "где здесь с++"=) ) проекта, там классы и все, как положено =)
    Причем писал не школьник, а взрослый дядька, у которого опыта больше, чем у меня сознательной жизни(ну это я образно=) ) Я до сих пор пребываю в состоянии культурно-эстетического шока =)

    ISith, 21 Января 2010

    Комментарии (20)
  9. PHP / Говнокод #2439

    +185.5

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    <?
    //------проверяем на совпадение логинов--------
    $query = "SELECT login FROM clients";
    $result = mysql_query($query, $dbConn);
    	while ($row = mysql_fetch_assoc($result)){
    		foreach ($row as $val){
    			if ($val==$login){
    				$flag_login='true';
    			}// if	
    		} // завершение цикла foreach
    	} // завершение цикла while 
    	//----------------------------------------
    if ($flag_login=='true'){$output.= "<li class='text_blue'>клиент с таким логином уже сужествует, введите другой</li><br>"; $z='1';};
    ?>

    (говно)проверка на совпадение логинов

    xXx_totalwar, 18 Января 2010

    Комментарии (20)
  10. JavaScript / Говнокод #2405

    +151.2

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    $('#state_checkboxes input[type=checkbox]').each(function(i) {
        $(this).click(function() {
            if (!$(this).attr('checked')) {
                if ($('#state_checkboxes input[type=checkbox]:checked').length == 0) {
                    $('#state_checkboxes input[type=checkbox]').not(this).attr('checked', 'checked');
                }
            }
        });
    });
    
    $('#type_checkboxes input[type=checkbox]').each(function(i) {
        $(this).click(function() {
            if (!$(this).attr('checked')) {
                if ($('#type_checkboxes input[type=checkbox]:checked').length == 0) {
                    $('#type_checkboxes input[type=checkbox]').not(this).attr('checked', 'checked');
                }
            }
        });
    });
    
    $('#own_checkboxes input[type=checkbox]').each(function(i) {
        $(this).click(function() {
            if (!$(this).attr('checked')) {
                if ($('#own_checkboxes input[type=checkbox]:checked').length == 0) {
                    $('#own_checkboxes input[type=checkbox]').not(this).attr('checked', 'checked');
                }
            }
        });
    });

    Только что наговнокодил, еще тепленькое.
    Суть в следующем: есть несколько пар чекбоксов, в каждой из этих пар обязательно должен быть выделен хотя бы один. Если снимаем выделение со всех чекбоксов в паре, то установиться выделение должно у другого чекбокса.
    В данном говнокоде 3 пары чекбоксов, у меня в проекте их будет больше, вот сижу и думаю, как бы это всё покрасивее сделать, а то совсем уже

    striker, 14 Января 2010

    Комментарии (20)
  11. JavaScript / Говнокод #2402

    +158.2

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    function compiledTest(ID, rank, memoryLimit, timeLimit, outputLimit, language, address){
        this.ID = ID;
        this.Rank = rank;
        this.MemoryLimit = memoryLimit;
        this.TimeLimit = timeLimit;
        this.OutputLimit = outputLimit;
        this.Language = language;
        this.Address = address;
        this.TestCases = new Array();
        
        this.getAnswer = function() {
            return document.getElementById(this.ID).value;
        }
        this.getScore = function() {
            var res = service(
                    this.getAnswer(), 
                    new this.allInfo(
                        this.Rank, this.MemoryLimit, this.TimeLimit, this.OutputLimit, this.Language, this.TestCases
                        ),
                    this.Address
                );
            
            return res;
        }
        
        // Смотри здесь ))))))
        this.allInfo = function(rank, memoryLimit, timeLimit, outputLimit, language, testCases) {
        
            this.Rank = rank;
            this.MemoryLimit = memoryLimit;
            this.TimeLimit = timeLimit;
            this.OutputLimit = outputLimit;
            this.TestCases = testCases;
            this.Language = language;
        }
        
        var c = arguments.length;
        for (var i = 6; i < c; i++) {
            this.TestCases.push(arguments[i]);
        }
    }

    Собственноличний говнокод. Буквально на днях писал єтот джаваскрипт. И только теперь заметил УЕБИЩНОЙ КОД. Проект пишется на С#. Джаваскрипта мало, но есть - приходилось писать его двум веб-программистам (также занимались С#) но они уже закончили свою роботу и ушли з проекта. Вот скинули на меня поодержку скриптов ( я js писал давно, но единственний в команде, кто его вообще писал). Написал первое, что пришло в голову для решения задачи.

    ajukraine, 14 Января 2010

    Комментарии (20)