1. Pascal / Говнокод #4895

    +107

    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
    Uses Windows;
    Var Olly : hWnd;
    begin
     Olly:=FindWindow('OllyDBG', nil);
     If Olly <> 0 then Exit;
     Olly:=FindWindow('OllyDbg', nil);
     If Olly <> 0 then Exit;
     Olly:=FindWindow('OLLYDBG', nil);
     If Olly <> 0 then Exit;
     Olly:=FindWindow('ollydbg', nil);
     If Olly <> 0 then Exit;
     MessageBox(0, 'You are run me!', 'RunMe v0.1', 48);
    end.

    Код моей молодости. Кто не вкурил, это такая говнозащита от отладчика OllyDbg.

    Govnocoder#0xFF, 11 Декабря 2010

    Комментарии (21)
  2. Куча / Говнокод #4894

    +133

    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
    <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#CC0000" width="1232" height="24">
      <tr>
        <td height="19" bgcolor="#FFFFFF" width="1232">
        <table border="0" cellpadding="2" style="border-collapse: collapse" bordercolor="#111111" width="1234" height="22">
          <tr>
            <td width="14%" height="18"><span lang="ru"><font size="1" color="#0000FF">&nbsp;Автор:
            </font><font color="#BF0000"><a title="Здравствуйте! Come in my page :-)" href="avb_inf.htm">
            <font color="#CC0000" size="2">А.В. Багров</font></a></font></span></td>
            <td width="31%" height="18">
            <p align="center"><span lang="ru"><font size="2" color="#0000FF">Дата и 
            время последнего обновления: &nbsp;</font></span><span lang="en-us"><font color="#BF0000">21</font></span><font color="#BF0000">.0<span lang="en-us">8</span>.2010 
            <span lang="en-us">0</span>:30</font></p>
            </td>
            <td width="23%" height="18">
            <p align="center"><font size="1" color="#0000FF">Объем сайта: </font>
            <span lang="en-us"><font size="2" color="#BF0000">7</font></span><font size="2" color="#BF0000"><span lang="ru">,</span><span lang="en-us">6</span> Мбайт </font>
            <font size="2" color="#0000FF">(из 250Мбайт)</font></p>
            </td>
            <td width="31%" height="18"><font size="2" color="#0000FF">e-mail (<span lang="ru">для 
            переписки по тематике сайта): </span></font><font color="#BF0000">[email protected]</font></td>
          </tr>
        </table>

    Я хотел завязать с постингом сюда HTML, но увидев вырвиглаз, не удержался. Страница http://avb-sites.pochta.ru/iBr_Diff.htm — вообще лютый звездец. Называется «Неадекватности интерпретации интернет-браузерами кода HTML». Цитирую: «Задуманный дизайн фрагмента интерпретируется правильно только в случае Интернет-Эксплорера. Остальные интернет-браузеры нарушают задуманный дизайн. Например, Opera воспроизводит красное обрамление шапки (вверху) черным цветом. Обрамление баннера белое по задумке отображается браузерами Mozilla Firefox и Opera совсем не так. Браузеры Google Chrome, Mozilla Firefox и Opera отображают название фирмы ЭЛИМАШ с подчеркиванием (имеется гиперссылка по этому имени), тогда как подчеркивание из дизайна было по задумке устранено.» Далее: «Браузеры Chrome, Firefox и Opera не реагируют на тег basefont. Тогда как IE делает это правильно.»

    Если Вы думаете, что я некрофил и откопал говно мамонта в недрах веб-кешей, то вот надпись на глагне сайта: «Дата и время последнего обновления: 21.08.2010 0:30». Короче, минусуйте ГК — не обижусь. И помните, как завещал Владимир Мономах, грешно смеяться над убогими.

    inkanus-gray, 11 Декабря 2010

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

    +168

    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
    46. 46
    47. 47
    48. 48
    49. 49
    function test_file_for_smells( $filename )
       {
       global $MAX_FUNCTION_LINE_COUNT, $MAX_INDENTATION_LEVEL;
       $function_line_count = 0;
       $found_continued_line = 0;
       $line_number = 0;
       $fp = fopen( $filename, "r" );
       if( ! $fp )
         return;
       while( ! feof( $fp ) )
         {
         $line = chop( fgets( $fp, 4096 ) );
         $line_number++;
         while( substr( $line, 0, 9 ) == "function "  &&
                substr( $line, strlen($line) - 1, 1 ) != ')' )
           {
           $line = $line . chop( fgets( $fp, 4096 ) )
           $found_continued_line++;
           }
         if( substr( $line, 0, 9 ) == "function " )
           {
           $function_line_count = 1;
           $function_name = substr( $line, 9, strpos($line, '(') - 9 );
           }
         if( $function_line_count > 0 )
           {
           if( $line == "\t}" )
             {
             $function_line_count = $function_line_count - 3;
             if( $function_line_count > $MAX_FUNCTION_LINE_COUNT )
               print_warning( $filename, $line, $line_number, "$function_name() too long ($function_line_count lines)" );
             $function_line_count = 0;
             }
           else
             $function_line_count++;
           $result = test_line_for_indentation( $line, $MAX_INDENTATION_LEVEL );
           if( ! $result )
             print_warning( $filename, $line, $line_number, "Too much nesting." );
           $result = test_line_for_function_definition( $line, $MAX_NUM_PARAMETERS );
           if( ! $result )
             print_warning( $filename, $line, $line_number, "Too many parameters." );
           if( $found_continued_line > 0 )
             {
             $line_number += $found_continued_line;
             $found_continued_line = 0;
             }
           }
         }
       }

    Детектор говнокода!!!!

    fork, 10 Декабря 2010

    Комментарии (10)
  4. PHP / Говнокод #4892

    +145

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    $addon = array (
    	(function () { return range(0,24); }),
    	(function () { return range(0,31); })
    );
    	print_r ( $addon[0]() );

    Во, чё... А это чё?..

    istem, 10 Декабря 2010

    Комментарии (11)
  5. C# / Говнокод #4891

    +122

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    public ActionResult View(string id)
    {
    	// some stupid code
    	return View("Picture");
    }

    Потратил больше часа, пытаясь разобраться, почему глючат роуты.

    andrewpey, 10 Декабря 2010

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

    +172

    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
    /*Diablo (18:24:45 10/12/2010)
    кароче я форму вынес в отдельный файл
    
     Diablo (18:24:50 10/12/2010)
    и хотел прицепить её так
    
     Diablo (18:24:55 10/12/2010)*/
    
    $addform = include "post_city.php";
    
     echo ( "$addform" );
    
    /*Aios (18:24:45 10/12/2010)
    и как? работает?))*/
    
     /*Diablo (18:24:50 10/12/2010)
    не ( белую страничку выдает*/

    Я был в шоке)))

    Aios, 10 Декабря 2010

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

    +163

    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
    function replaceBBCodes($text){ 
    $text=str_replace("/\n/m", "$0<br/>", $text);
    $text = htmlspecialchars($text);
    $text=nl2br($text);
    $text=stripslashes($text);   
    $text=str_replace("!#3040#!", "&", $text);
    $text=str_replace('[b]', '<strong>', $text);
    $text=str_replace('[/b]', '</strong>', $text);
    $text=str_replace('[i]', '<em>', $text);
    $text=str_replace('[/i]', '</em>', $text);
    $text=str_replace('[u]', '<u>', $text);
    $text=str_replace('[/u]', '</u>', $text);
    $text=str_replace('[s]', '<s>', $text);
    $text=str_replace('[/s]', '</s>', $text);
    $text=str_replace('[left]', '<span class="bb_left">', $text);
    $text=str_replace('[/left]', '</span>', $text);
    $text=str_replace('[right]', '<span class="bb_right">', $text);
    $text=str_replace('[/right]', '</span>', $text);
    $text=str_replace('[center]', '<span class="bb_center">', $text);
    $text=str_replace('[/center]', '</span>', $text);
    $text=str_replace('[justify]', '<span class="bb_justify">', $text);
    $text=str_replace('[/justify]', '</span>', $text);
    $text=preg_replace("#\[color=(.*?)](.*?)\[/color\]#si", '<span style="color:$1">$2</span>',$text);
    $text=preg_replace("#\[size=(.*?)](.*?)\[/size\]#si", '<span style="font-size:$1px">$2</span>',$text);
    $text=preg_replace("#\[a=(.*?)](.*?)\[/a\]#si", '<a href="$1">$2</a>',$text);
    $text=preg_replace("#\[img=(.*?)](.*?)\[/img\]#si", '<img src="$2" alt="images" style="float:$1;margin:5px;" />',$text);
    $text=preg_replace("#\[youtube](.*?)\[/youtube\]#si",'<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/$1"></param><embed src="http://www.youtube.com/v/$1" type="application/x-shockwave-flash" width="425" height="350"></embed></object>',$text);
    $text=preg_replace("#\[youtube](.*?)\[/youtube\]#si",'<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/$1"></param><embed src="http://www.youtube.com/v/$1" type="application/x-shockwave-flash" width="425" height="350"></embed></object>',$text);
    $text=preg_replace("#\[spoiler=(.*?)](.*?)\[/spoiler\]#si", '<div id=\'video\'><h1 class="headtt2" onclick="expandit(this)">$1</h1>
    <div style="display:none;" class="sdsp">         $2</div> </div>', $text);
    $text=preg_replace("#\[podspoiler=(.*?)](.*?)\[/podspoiler\]#si", '<h1 class="headtt" onclick="expandit(this)">$1</h1>
    <div style="display:none;text-align:center">$2</div>', $text);
    return $text; 
    }

    qbasic, 10 Декабря 2010

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

    +165

    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
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    83. 83
    84. 84
    85. 85
    86. 86
    87. 87
    88. 88
    89. 89
    90. 90
    91. 91
    <?php 
    header("Content-Type: text/html; charset=windows-1251");
    defined('_JEXEC') or die('<html>
    <head><title>404 Not Found</title></head>
    <body bgcolor="white">
    <center><h1>404 Not Found</h1></center>
    <hr><center>nginx/0.7.59</center>
    </body>
    </html>');
    $url = $_SERVER['HTTP_HOST'];
    $host = $_SERVER['DOCUMENT_ROOT'];
    
    if(!file_exists($host."/data/conf.php")) die("Система не установленна!");
    
    include $host.'/data/conf.php';
    
     function generate_password($a)  
      {  
        if($a==1){
    	return rand(111111,99999999); }
        else if($a==2){
        $arr = array('a','b','c','d','e','f',  
                     'g','h','i','j','k','l',  
                     'm','n','o','p','r','s',  
                     't','u','v','x','y','z', 
    				 );      $pass = "";  
    	$n = rand(6,10);
        for($i = 0; $i < $n; $i++)  
        {  
          $index = rand(0, count($arr) - 1);  
          $pass .= $arr[$index];  
        }  
        return $pass; }
    	else if($a==3){
        $arr = array('a','b','c','d','e','f',  
                     'g','h','i','j','k','l',  
                     'm','n','o','p','r','s',  
                     't','u','v','x','y','z',  
                     'A','B','C','D','E','F',  
                     'G','H','I','J','K','L',  
                     'M','N','O','P','R','S',  
                     'T','U','V','X','Y','Z', 
    				 );      $pass = "";  
    	$n = rand(6,10);
        for($i = 0; $i < $n; $i++)  
        {        
          $index = rand(0, count($arr) - 1);  
          $pass .= $arr[$index];  
        }  
        return $pass; }
    	else if($a==4){
        $arr = array('a','b','c','d','e','f',  
                     'g','h','i','j','k','l',  
                     'm','n','o','p','r','s',  
                     't','u','v','x','y','z',  
                     'A','B','C','D','E','F',  
                     'G','H','I','J','K','L',  
                     'M','N','O','P','R','S',  
                     'T','U','V','X','Y','Z',  
                     '1','2','3','4','5','6',  
                     '7','8','9','0', 
    				 );     $pass = "";  
    	$n = rand(10,16);
        for($i = 0; $i < $n; $i++)  
        {  
          $index = rand(0, count($arr) - 1);  
          $pass .= $arr[$index];  
        }  
        return $pass;  }
    	else if($a==5){
      $arr = array('a','b','c','d','e','f',  
                     'g','h','i','j','k','l',  
                     'm','n','o','p','r','s',  
                     't','u','v','x','y','z',  
                     'A','B','C','D','E','F',  
                     'G','H','I','J','K','L',  
                     'M','N','O','P','R','S',  
                     'T','U','V','X','Y','Z',  
                     '1','2','3','4','5','6',  
                     '7','8','9','0','.',',',  
                     '(',')','[',']','!','?',  
                     );      $pass = "";  
    	$n = rand(10,16);
        for($i = 0; $i < $n; $i++)  
        {  
          $index = rand(0, count($arr) - 1);  
          $pass .= $arr[$index];  
        }  
        return $pass; }
     
      }   // генератор паролей

    qbasic, 10 Декабря 2010

    Комментарии (23)
  9. Pascal / Говнокод #4887

    +102

    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
    function FileIsBusy(AFileName: string): Boolean;
    var
      F: Integer;
    begin
      F := FileOpen(AFileName, fmShareExclusive);
      Result := F = -1;
      FileClose(F);
    end;
    
    function WaitFile(AFileName: string; ASpeepDelay: integer): Boolean;
    begin
      while FileIsBusy(AFileName) do
        Sleep(ASpeepDelay);
      Result := True;
    end;

    пока юзверь ковыряется в Ворде, другой процесс мечтает овладеть файлом
    "It is necessary to wait of end of editing Microsoft Office files.I use next conventional approach: file is editing While file is busy" (ингриш - питерского разлива)

    это stackoverflow такими сниппетами переполнено

    bugmenot, 10 Декабря 2010

    Комментарии (24)
  10. PHP / Говнокод #4886

    +168

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    <?php
    ...
    $string = array();
    ...
    ?>

    hidespb, 10 Декабря 2010

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