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

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

    +130.3

    1. 1
    2. 2
    3. 3
    void View1(){
         SaveResult1();	
    }

    guest, 13 Марта 2009

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

    +167.2

    1. 1
    2. 2
    3. 3
    4. 4
    if (!!Flag === true)
    {
     ...
    }

    guest, 13 Марта 2009

    Комментарии (3)
  4. Perl / Говнокод #682

    −305.9

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    my @idx = map{ (split(/\|/, $_))[0] || () }
    	    map{ io($_)->chomp->slurp } 
    		io($boardsdir)->filter(sub{ my $f = fileparse($_->name, qr/.txt/i);
    					    $_->name =~ /\.txt$/i and grep{$_ eq $f} @board;
    					})->all_files;

    Так бывает, когда хочется одним предложением сказать все.

    guest, 07 Марта 2009

    Комментарии (3)
  5. PHP / Говнокод #661

    +152

    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
    <?php
     mysql_connect  ($server, $username, $password);
    //Данные на базу
    $lnk = mysql_connect('localhost', 'mysql_user', 'mysql_password')
           or die ('Not connected : ' . mysql_error());
    mysql_select_db('primecms_db', $lnk) or die ('Can\'t primecms_db foo : ' . mysql_error());
    
    
    class insert{
    	var $pid, $alias, $text, $position, $status, $create_time, $modify_time;
    }
    
    function con_in($pid, $alias, $text_en, $text_ru, $text_descr, $position, $status, $create_time, $modify_time){
    	$res = new insert;
    	$res->pid=$pid;
    	$res->alias=addslashes($alias);
    	$res->text='<p>'.addslashes($text_en).'</p>\r\n<p>'.addslashes($text_ru).'</p>\r\n<p>'.addslashes($text_descr).'</p>';
    	$res->position=$position;
    	$res->status=$status;
    	$res->create_time=$create_time;
    	$res->modify_time=$modify_time;
    	return $res;
    }
    
    if ($_POST['send']){
    	$con =  con_in($_POST['pid'],$_POST['alias'],$_POST['text_en'],$_POST['text_ru'],$_POST['text_descr'],$_POST['position'],$_POST['status'],$_POST['create_time'],$_POST['modify_time']);
    	mysql_query("INSERT INTO e118_glossary_items (`id`, `pid`, `alias`, `text`, `position`, `status`, `create_time`, `modify_time`) VALUES (".$con->pid.",".$con->alias.",".$con->text.",".$con->position.",".$con->status.",".$con->create_time.",".$con->modify_time.")");
    }
    ?>
    
    <form name="" action="" method="post">
    Pid<input name="pid" size=30 type="text" value=""><br />
    Allias<input name="allias" size=30  type="text" value=""><br />
    text_en<input name="text_en" size=30 type="text" value=""><br />
    text_ru<input name="text_ru" size=30  type="text" value=""><br />
    text decr<textarea name="text_descr" rows=7 cols=50 wrap="off"></textarea><br />
    position<input name="position" size=30  type="text" value=""><br />
    status<input name="status" size=30  type="text" value="">    <br />
    create_time<input name="create_time" size=30  type="text" value=""><br />
    modify_time<input name="modify_time" size=30  type="text" value=""><br />
    <input type="submit" value="Send" name="send"><br />
    </form>

    для инсёрта
    назови insert.php
    подправь //Данные на базу

    guest, 04 Марта 2009

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

    +137.7

    1. 1
    2. 2
    3. 3
    4. 4
    foreach ($_pp as $k => $v){
                if ($v['qty'] == $_pp[$i*count($groups)]['qty']){
                    $qtys[$i][]=$v;
                }

    За такое надо кромсать

    guest, 27 Февраля 2009

    Комментарии (3)
  7. PHP / Говнокод #602

    +138.7

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    <?
    // ....
    $POST_MAX_SIZE = ini_get('post_max_size');
    $mul = substr($POST_MAX_SIZE, -1);
    $mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)));
    // ....
    ?>

    я ещё такой глубины условий не встречал в такой форме

    guest, 23 Февраля 2009

    Комментарии (3)
  8. PHP / Говнокод #600

    +134

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    <?
    for($i=0;$i<100;$i++){
     header("Location: govnokod");
    }
    ?>

    xek

    guest, 23 Февраля 2009

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

    +147

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    $Domain="asdasasdsad.ru";
    $Lookup = "nslookup $Domain";
    $Results = shell_exec(EscapeShellCmd($Lookup));
    if (preg_match("/$Domain/",$Results)) {
    	echo $Results;
    	echo "Домен Существует!";
    } else {
    	echo "Домен не существует!";
    }

    php

    guest, 21 Февраля 2009

    Комментарии (3)
  10. C# / Говнокод #579

    +145.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
    // тип System.Int32[]
    int[] d = new int[0] { };
    
    // тип System.Int32[,]
    int[,] d = new int[3,0] { {}, {}, {} }
    
    // тип System.Int32[,]
    int[,] d = new int[1,0] { {} };	
    
    // тип  System.Int32[, ,]
    int[, ,] d = new int[2, 1, 0] { { { } }, { { } } };	
    		
    // тип System.Int32[, , , , ,] и т.д.
    int[, , , , ,] d = new int[1, 1, 1, 1, 1, 0] { { { { { { } } } } } };	
    
    // System.Int32[][][][][][][][][][][][][][][][][][][][][][][][][]
    // (jagged array)
    int[][][][][][][][][][][][][][][][][][][][][][][][][] d = 
       new int[5][][][][][][][][][][][][][][][][][][][][][][][][];

    главное все работает
    теперь осталось найти применение.. :)

    guest, 19 Февраля 2009

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

    +158.9

    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
    if(this.o)
    {
        if((cur=='1')||(cur=='2'))cur='2';
        if((cur=='3')||(cur=='4'))cur='4';
        if((cur=='5')||(cur=='6'))cur='6';
        if((cur=='7')||(cur=='8'))cur='8';
    };
    
    /*
        Ну а чувакам пИсавшим эту функциию, посвящается:
    */
    if(cur & 1)
        ++cur;

    Фрагмент кода из CMS Bitrix 7

    guest, 19 Февраля 2009

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