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

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

    +156.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
    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
    92. 92
    <?php
    session_start();
    $lgn=$_SESSION['lgn'];
    $pswd=$_SESSION['pswd'];
    //  print_r($_GET);
    include_once('spyLib.php');
    $dbConn=connectToSpy();
    mysql_query("SET NAMES cp1251");
    $option=$_REQUEST['option'];
      
    $ID=autentID($lgn, $pswd);
    //$ID='45';
    if ($ID=='8') {
    
      if ($option=='editTable'){
      include_once("bd/editTable.php");
      }elseif($option=="addRecord"){
      include_once( 'bd/addRecord.php' );
      }elseif($option=="processAdd"){
      include_once( 'bd/processAdd.php' );
      }elseif($option=="deleteRecord"){
      include_once( 'bd/deleteRecord.php' );
      }elseif($option=="editRecord"){
      include_once( 'bd/editRecord.php' );
      }elseif($option=="updateRecord"){
      include_once( 'bd/updateRecord.php' );  
      }else{
      
      print <<<HERE
    <link href="./style.css" rel="stylesheet" type="text/css">
      <!-----------главная страница------------------------------------->
    <img src="./img/fonpageleft.png" style="position: absolute; top:50px; left: 50px;" width="670" height="370">
    <div style="position: absolute; top:70px; left: 100px;">
    
    <form action="index.php" method="post">
      <input name="ok" type="image" src="img/admin.gif" class="bulleon" alt="Перейти на сайт">
    </form>
    <table border="0" cellpadding="0" cellspacing="0">
      <tr>
      <td valign="top" width="458">
      <div class="text_10">Страница находится в разработке.</div>
      <form action="admin.php">
      <input name="option" type="hidden" value="editTable">
      <input name="page" type="hidden" value="admin">
      <input name="back" type="hidden" value="false">
      <table cellspacing="1" cellpadding="3" width='100%'>
      <tr  class="title">
      <td>
      </td>
      <td class='title2'>
      Выберите таблицу для редактирования
      </td>
      <td>
      </td>
      </tr>
      <tr class='table_top'>
      <td width='30' nowrap="nowrap">
      </td>
      <td  align="left">
      <select name="tableName" size=5>
      <option value="kompleks">комплексы</option>
      <option value="glav">главная страница</option>
      <option value="bulletin">новости</option>
      <option value="forleader">для руководителей</option>
      <option value="lunchoffice">обеды в офис</option>
      <option value="partner">партнеры</option>
      <option value="contact">контакты</option>
      <option value="review">отзывы</option>
      </select>
      </td>
      <td width='30' nowrap="nowrap">
      </td>
      </tr>
      <tr>
      <td colspan='3' align='left'>
      <input name="option2" type="image" value="1" src="./img/ok4.gif" class="bulleon">
      </td>
      </tr>
      </table>
      </form>
      </td>
        </tr>
      </table>
    </div>
    <!---!--------главная страница------------------------------------->
    HERE;
      }//if
    
    }else{
      print "<p class=\"mes_small_error\">Попробуйте ввести пороль и логин еще раз</p>";
    }
    ?>

    что тут комментировать - аффтар даже русский с трудом осилил: "Попробуйте ввести пороль"(sic!)

    xXx_totalwar, 09 Января 2010

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

    +162.3

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    $comments = (isset($_POST['lici-'.$login->id.'-comments']))?"yes":"no";
    
    if($comments === "yes")
    {
    $xml .= "<nocomment>1</nocomment>\r\n";
    }

    Код из плагина кросспостера для wordpress.
    Автор, видимо, не знает про булев тип. Все бы было хорошо, если бы плагин не закрывал комментарии, когда их нужно было открывать.

    gunya, 31 Декабря 2009

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

    +63.4

    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
    /* This construction seems to be more optimiser friendly.
           (without it gcc does the isDIGIT test and the *s - '0' separately)
           With it gcc on arm is managing 6 instructions (6 cycles) per digit.
           In theory the optimiser could deduce how far to unroll the loop
           before checking for overflow.  */
        if (++s < send) {
          int digit = *s - '0';
          if (digit >= 0 && digit <= 9) {
            value = value * 10 + digit;
            if (++s < send) {
              digit = *s - '0';
              if (digit >= 0 && digit <= 9) {
                value = value * 10 + digit;
                if (++s < send) {
                  digit = *s - '0';
                  if (digit >= 0 && digit <= 9) {
                    value = value * 10 + digit;
    		        if (++s < send) {
                      digit = *s - '0';
                      if (digit >= 0 && digit <= 9) {
                        value = value * 10 + digit;
                        if (++s < send) {
                          digit = *s - '0';
                          if (digit >= 0 && digit <= 9) {
                            value = value * 10 + digit;
                            if (++s < send) {
                              digit = *s - '0';
                              if (digit >= 0 && digit <= 9) {
                                value = value * 10 + digit;
                                if (++s < send) {
                                  digit = *s - '0';
                                  if (digit >= 0 && digit <= 9) {
                                    value = value * 10 + digit;
                                    if (++s < send) {
                                      digit = *s - '0';
                                      if (digit >= 0 && digit <= 9) {
                                        value = value * 10 + digit;
                                        if (++s < send) {
                                          /* Now got 9 digits, so need to check
                                             each time for overflow.  */
                                          digit = *s - '0';
                                          while (digit >= 0 && digit <= 9
                                                 && (value < max_div_10
                                                     || (value == max_div_10
                                                         && digit <= max_mod_10))) {
                                            value = value * 10 + digit;
                                            if (++s < send)
                                              digit = *s - '0';
                                            else
                                              break;
                                          }
                                          if (digit >= 0 && digit <= 9
                                              && (s < send)) {
                                            /* value overflowed.
                                               skip the remaining digits, don't
                                               worry about setting *valuep.  */
                                            do {
                                              s++;
                                            } while (s < send && isDIGIT(*s));
                                            numtype |=
                                              IS_NUMBER_GREATER_THAN_UV_MAX;
                                            goto skip_value;
                                          }
                                        }
                                      }
    				 }
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
    	 }
          }
        }

    Проверка числа в Perl-модуле. Судя по всему стояла задача оптимизировать под что-то.

    Thomas_55, 30 Декабря 2009

    Комментарии (4)
  5. Pascal / Говнокод #2353

    +92

    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
    {$R-}
    fal:=true;
    ty:= length(mas1);
    while(fal=true)  do
      for j:=0 to kp-1 do
      begin
        for i:=i+k+j to length(mas2)-1 do
        begin
          while mas2[i+k]= ty do
          begin
            s:=s+c[i,j];
            inc(k);
          end;
        end;
        nl:=mas1[ty-1];
        if nl=0 then
          mas_Mj[ty]:=0
        else
          mas_Mj[ty-1][j]:=s/nl;
        s:=0;
      end;

    TAX, 30 Декабря 2009

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

    +168.1

    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
    function check($pass) 
    { if (strpos($pass,'0') || strpos($pass,'1') 
        || strpos($pass,'2') || strpos($pass,'3') 
        || strpos($pass,'4') || strpos($pass,'5') 
        || strpos($pass,'6') || strpos($pass,'7') 
        || strpos($pass,'8') || strpos($pass,'9')) 
        { 
         if (strpos($pass,'a') || strpos($pass,'b') || strpos($pass,'c') 
             || strpos($pass,'d') || strpos($pass,'e') || strpos($pass,'f') 
             || strpos($pass,'g') || strpos($pass,'h') || strpos($pass,'i') 
             || strpos($pass,'j') || strpos($pass,'k') || strpos($pass,'l') 
             || strpos($pass,'m') || strpos($pass,'n') || strpos($pass,'o') 
             || strpos($pass,'p') || strpos($pass,'q') || strpos($pass,'r') 
             || strpos($pass,'s') || strpos($pass,'t') || strpos($pass,'u') 
             || strpos($pass,'v') || strpos($pass,'w') || strpos($pass,'x') 
             || strpos($pass,'y') || strpos($pass,'z')) 
             { 
              if (strpos($pass,'A') || strpos($pass,'B') || strpos($pass,'C') 
                  || strpos($pass,'D') || strpos($pass,'E') || strpos($pass,'F') 
                  || strpos($pass,'G') || strpos($pass,'H') || strpos($pass,'I') 
                  || strpos($pass,'J') || strpos($pass,'K') || strpos($pass,'K') 
                  || strpos($pass,'M') || strpos($pass,'N') || strpos($pass,'O') 
                  || strpos($pass,'P') || strpos($pass,'Q') || strpos($pass,'R') 
                  || strpos($pass,'S') || strpos($pass,'T') || strpos($pass,'U') 
                  || strpos($pass,'V') || strpos($pass,'W') || strpos($pass,'X') 
                  || strpos($pass,'Y') || strpos($pass,'Z')) 
                  {                if (ctype_lower(substr($pass,0,1)) || ctype_upper(substr($pass,0,1)) || is_numeric(substr($pass,0,1))) 
                       {                        if (ctype_lower(substr($pass,0,1))) 
                               {                             if (!ctype_lower(substr($pass,-1))) 
                                    {                                  return $pass;                                 }                            } 
                           if (ctype_upper(substr($pass,0,1))) 
                               { 
                                if (!ctype_upper(substr($pass,-1))) 
                                    { 
                                     return $pass; 
                                    } 
                               } 
                           if (is_numeric(substr($pass,0,1))) 
                               { 
                                if (!is_numeric(substr($pass,-1))) 
                                    { 
                                     return $pass; 
                                    } 
                               }                    } 
                  } 
             } 
        } }

    без коментариев. (из одного вап чата)

    [email protected], 28 Декабря 2009

    Комментарии (4)
  7. Куча / Говнокод #2338

    +122.4

    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
    <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    
           <!--
    
    POSTER PHOTO
    
    -->
        <div id="poster-photo-container">
            <img src="images/photo-poster.jpg" alt="" class="poster-photo-image" />
              <div id="feature-area-home">
              
                  <div id="login" class="boxed">
    			<h2 class="title">Аккаунт пользователя</h2>
    			<div class="content">
    					<fieldset>
    					<legend>Войти</legend>
    					<label for="inputtext1">Аккаунт :</label>
    					<input id="inputtext1" type="text" name="inputtext1" value="" />
    					<label for="inputtext2">Пароль :</label>
                            <input id="inputtext2" type="password" name="inputtext2" value="" />
                            <asp:Button ID="Button1" runat="server" Text="Войти" onclick="Button1_Click" />
    
                             <p><a href="#">Забыли пароль ?</p>
    					    </a>
    					</fieldset>
    				</div>
    				
    		</div>
            </div>
        </div>
        <!--
    
    CONTENT CONTAINER
    
    -->
        <div id="content-container-two-column">
            <!--
    
    CONTENT MAIN COLUMN
    
    -->
            <div id="content-main-two-column">
                <h1>
                    <span lang="ru">Контроль измерительных приборов.</span> </h1>
                <p>
                    Consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet
                    dolore magna aliquam erat volutpat.</p>
                <div id="three-column-container">
                    <div id="three-column-side1">
                        <a href="Items.aspx">
                            <img src="images/home-photo-1.jpg" class="photo-border" alt="Enter Alt Text Here" /></a>
                        <h2>
                            <span lang="ru">Хромотографы ?</span></h2>
                        <p>
                            <span lang="ru">11111111</span></p>
                        <span lang="ru">
                        <a href="Items.aspx">Подробнее</a></span><img class="arrow" src="images/arrow.gif" alt="" /></div>
                </div>
            </div>
            <!--
    
    CONTENT SIDE COLUMN
    
    -->
            <div class="clear">
            </div>
        </div>
    </asp:Content>

    Найти DIV

    Nemerle, 28 Декабря 2009

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

    +103

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    MessageBox.Show(
     a.Decode(
      new StringBuilder(
       a.Encode(
         new StringBuilder(
           textBox1.Text)).ToString())).ToString());

    Говнокод... ну почти говнокод. Думаю, замечание.

    ajukraine, 22 Декабря 2009

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

    −106.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
    # ВЫШЕ БУДЕТ МАСИВ С 1 до 7 за семь дней дабы делать выборку
    for ($indx=0; $indx<7; $indx++) {	## каждый раз работаем с датой
    @sql=();
    
    my $bindings = 0;
    
    ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time+$indx*86400); # а тут надо будет написать что умножить эл. масива на чтото
    $date=($year+1900).'-'.($mon<9?'0':'').($mon+1).'-'.($mday<10?'0':'').$mday;
    $url2=$url.$date;
    #####$url2=$url;
    
    $cinema=&get($url2);
    
    ...
    
    } # это скобка массива

    Вот такой фрагмент парсера. Комменты читать по 3-4 раза для полного впечатления

    Suor, 22 Декабря 2009

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

    +163.4

    1. 1
    $file_dump->isOpened()?$file_dump->close():die ($file_dump->open());

    AlDjabad, 22 Декабря 2009

    Комментарии (4)
  11. SQL / Говнокод #2296

    −876

    1. 1
    INSERT INTO `x_world` VALUES (157282,-115,204,1,206320,'Жопа Волосатая',68797,'Чере',3277,'WarSky',595);

    Омг!
    Код взят с http://www.google.com/codesearch/p?hl=ru#Vh-Pv7tO-E0/map.sql&q=%D0%B6%D0%BE%D0%BF%D0%B0&sa=N& cd=8&ct=rc

    x0wl, 18 Декабря 2009

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