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

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

    +158

    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
    <?php
    include 'config.php';
    $title = "Форум - $maintitle";
    $topic = $_GET['topic'];
    $board = $_GET['board'];
    $main = $_GET['main'];
    include 'core/funcs.php';
    include 'core/pdoconnect.php';
    include 'te/heads.php';
    echo '
     <div class="clear"></div>
        <!-- Content Section -->
        <div id="content_sec">
        	<!-- Column 1 -->
            <div class="col1">
            	<!-- Featured Playlist -->
            	<div class="featured_playlist">
                	<h3 class="heading">',$title,'</h3>
    
    				';
    
    if (isset($topic)){
    echo '<table>
      <tbody>
      <tr><th> Тема</th><th>Автор</th><th>Посл.обн.</th>
      </tr>';
    
    }
    if ($board > 0){
    echo '<table>
      <tbody>
      <tr><th> Тема</th><th>Автор</th><th>Посл.обн.</th>
      </tr>';
    $prepare = $db->prepare("SELECT * from `forum` where `board_id` = :bo_id order by `last_update` DESC");
    $prepare->bindParam(":bo_id", $board, PDO::PARAM_INT);
    $prepare -> execute();
    //print_r($prepare->errorinfo());
    if ($prepare->rowCount() == 0){
    echo '<p class = "error-box">В этом разделе еще не создано ни одной темы!</p>';
    }else{
    while($bo = $prepare->fetch(PDO::FETCH_BOTH)){
    echo '<tr><td><a href="forum-topic',$bo['id'],' "> ',$bo['title'],' </a></td><td> ',$bo['author'],'</td><td> ',$bo['last_author'],'</td></tr>';
    }
      }
    }
    if (isset($_GET['main'])){
    $i = 1;
    echo '
    <table>
      <tbody>
         <tr>
            <th>Основной</th><th>Новое</th>
         </tr>
    	 <tr><td><a href = "forum-board',$i++,' ">Работа сайта</a></td><td>',$last['0'],'</td></tr> 
    	 <tr><td><a href = "forum-board',$i++,' ">Пожелания и предложения</a></td><td>',$last['1'],'</td>
    	 <tr><th>Общение</th><th>Новое</th></tr>
    	 <tr><td><a href = "forum-board',$i++,' ">Общение</a></td><td>',$last['2'],'</td></tr>
    	 <tr><th>Работа</th><th>Новое</th></tr>
    	 <tr><td><a href = "forum-board',$i++,' ">Оффтоп</td><td>$last['3']</td></tr>
    	 <tr><td><a href = "forum-board',$i++,' ">Студенты</td><td>$last['4']</td></tr>
    	 <tr><td><a href = "forum-board',$i++,' ">Преподаватели</td><td>$last['5']</td></tr>
    	 <tr><td><a href = "forum-board',$i++,' ">Помощь</td><td>$last['6']</td></tr>
    	 <tr><td><a href = "forum-board',$i++,' ">Литература</td><td>$last['7']</td></tr>
    	 ';
    
    	 }
    
    
    echo '</tbody></table></div></div>';
    include 'te/foot.php';
    
    ?>

    В общем, добрался до исходников сайта нашего инста.
    Сам сайт имеет всего несколько частей - форум, лента новостей и ЛК.

    Это скрипт "форума".

    К слову, написано преподавателем со стажем работы 6 лет, как сам он нам доказывал и доказывает - часто фрилансит и все довольны. Чет не верится.

    И этот человек учит других...

    RSLab, 05 Сентября 2014

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

    +158

    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
    class TestThis
    {
        public $property = 'property';
    
        public function test1()
        {
            $this->this($this, new ArrayObject);
    
            $this['wierd'] = true;
    
            print_r($this);
            print_r($this->property . PHP_EOL);
    
            return $this;
        }
    
        public function test2()
        {
            print_r($this);
        }
    
        public function this(&$object, $value)
        {
            $object = $value;
        }
    }
    
    (new TestThis)->test1()->test2();

    Вопрос к самому похапе.

    Так вот нельзя:
    $this = че-нибудь

    "Cannot re-assign $this"

    А вот как выше можно!

    doo_dee_doo_dmt, 02 Сентября 2014

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

    +158

    1. 1
    2. 2
    3. 3
    if( is_numeric((int)$_GET['id1']) && is_numeric((int)$_GET['id2']) && is_numeric((int)$_GET['id3']) ){
    
    }

    Капитан очевидность)

    sa-kirich, 01 Сентября 2014

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

    +158

    1. 001
    2. 002
    3. 003
    4. 004
    5. 005
    6. 006
    7. 007
    8. 008
    9. 009
    10. 010
    11. 011
    12. 012
    13. 013
    14. 014
    15. 015
    16. 016
    17. 017
    18. 018
    19. 019
    20. 020
    21. 021
    22. 022
    23. 023
    24. 024
    25. 025
    26. 026
    27. 027
    28. 028
    29. 029
    30. 030
    31. 031
    32. 032
    33. 033
    34. 034
    35. 035
    36. 036
    37. 037
    38. 038
    39. 039
    40. 040
    41. 041
    42. 042
    43. 043
    44. 044
    45. 045
    46. 046
    47. 047
    48. 048
    49. 049
    50. 050
    51. 051
    52. 052
    53. 053
    54. 054
    55. 055
    56. 056
    57. 057
    58. 058
    59. 059
    60. 060
    61. 061
    62. 062
    63. 063
    64. 064
    65. 065
    66. 066
    67. 067
    68. 068
    69. 069
    70. 070
    71. 071
    72. 072
    73. 073
    74. 074
    75. 075
    76. 076
    77. 077
    78. 078
    79. 079
    80. 080
    81. 081
    82. 082
    83. 083
    84. 084
    85. 085
    86. 086
    87. 087
    88. 088
    89. 089
    90. 090
    91. 091
    92. 092
    93. 093
    94. 094
    95. 095
    96. 096
    97. 097
    98. 098
    99. 099
    100. 100
    /// =------------------------------------
               if($razdel_cataloga=="kabinet-gastroenterologii-i-endoskopii") { 
                    $nameeeeee = 'Кабинет гастроэнтерологии и эндоскопии';
    
    
    
                                    $info_variables['slide_show_top_banners'] = '
        <ul class="thumbnails">
        <li class="span3">
        <a href="/images/photo/gastroenterologii800/gastroenterologii1.jpg" class="thumbnail">
        <img src="/images/photo/gastroenterologii200/gastroenterologii1.jpg" alt="Кабинет ГАСТРОЭНТЕРОЛОГИИ">
        </a>
        </li>
        <li class="span3">
        <a href="/images/photo/gastroenterologii800/gastroenterologii2.jpg" class="thumbnail">
        <img src="/images/photo/gastroenterologii200/gastroenterologii2.jpg" alt="Кабинет ГАСТРОЭНТЕРОЛОГИИ">
        </a>
        </li>
        <li class="span3">
        <a href="/images/photo/gastroenterologii800/gastroenterologii3.jpg" class="thumbnail">
        <img src="/images/photo/gastroenterologii200/gastroenterologii3.jpg" alt="Кабинет ГАСТРОЭНТЕРОЛОГИИ">
        </a>
        </li>
        <li class="span3">
        <a href="/images/photo/gastroenterologii800/gastroenterologii4.jpg" class="thumbnail">
        <img src="/images/photo/gastroenterologii200/gastroenterologii4.jpg" alt="Кабинет ГАСТРОЭНТЕРОЛОГИИ">
        </a>
        </li>
      
        </ul>
    ';
    
    
                    
                    $info_variables['center'] = ' <h3 id="overview">Кабинет гастроэнтерологии и эндоскопии. Поликлиника. Комплекс «Времена года»</h3>
                    <div class="art-Post-inner">
    
    
    <div class="art-PostContent">
    <div class="art-article"><table class="table table-bordered table-hover">
    <colgroup><col width="416"> <col width="64"> <col width="85"> <col width="73"> <col width="65"> </colgroup>
    <tbody>
    <tr>
    <td width="416">Наименование    услуги</td>
    <td width="64">Кол-во</td>
    <td width="65">Стоим. <br> всего(грн.)</td>
    </tr>
    <tr>
    <td width="416">Гидроколонотерапия</td>
    <td>1 проц.</td>
    <td width="65">125,00</td>
    </tr>
    <tr>
    <td width="416">Гидроколонотерапия + фитотерапия(или биопрепараты)</td>
    <td>1 проц.</td>
    <td width="65">150,00</td>
    </tr>
    <tr>
    <td width="416">Гидроколонотерапия + минеральная вода</td>
    <td>1 проц.</td>
    <td width="65">150,00</td>
    </tr>
    <tr>
    <td width="416">Очистительная клизма</td>
    <td>1 проц.</td>
    <td width="65">20,00</td>
    </tr>
    <tr>
    <td width="416">Сифонная клизма</td>
    <td>1 проц.</td>
    <td width="65">40,00</td>
    </tr>
    <tr>
    <td>Клизма с    биопрепаратами</td>
    <td>1 проц.</td>
    <td>30,00</td>
    </tr>
    <tr>
    <td width="416">Лечебная клизма</td>
    <td>1 проц.</td>
    <td width="65">40,00</td>
    </tr>
    <tr>
    <td width="416">Фиброгастродуоденоскопия</td>
    <td>1 проц.</td>
    <td width="65">180,00</td>
    </tr>
    <tr>
    <td width="416">Фиброколоноскопия</td>
    <td>1 проц.</td>
    <td width="65">180,00</td>
    </tr>
    <tr>
    <td width="416">Фибробронхоскопия</td>
    <td>1 проц.</td>
    <td width="65">250,00</td>
    </tr>
    <tr>
    <td width="416">Лечебная бронхоскопия</td>
    <td>1 проц.</td>

    Всё тот же печально известный кодер.
    Весь файл (513 КБ) - две функции, одна из которых состоит из нескольких тысяч подобных строчек.

    Uhehesh, 25 Августа 2014

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

    +158

    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
    function print_neeewwww_showall($num)
    function print_hhhooootttt_showall($num)
    function how_fuylll_on_maps()
    function how_have_errors($id)
    function pogodas()
    function nowpricesmap_seo_minus_valute($id, $text)
    function generate_info_rezult_rajon_podlist_anchor($rajon, $q, $groupid) 
    function spryagi($digit,$expr,$onlyword=false)
    function view_photos_random_and_167() 
    function search_tagsisssmenu($tag, $type_id)
    function search_tagsisssbt_for_selectgr($tag, $type_id, $minus, $css="")
    function printpodplitkefor_meeee($object_id)
    function makephoto_hot()
    function update_appartaments_to_sdan($id)
    function arenda_kvartir_v_yalte_posutochno()
    function gostinicy_yalty()
    function jile_v_yalte()
    function index_аа()
    function shlinkss()
    function fast()

    Функции.

    Uhehesh, 25 Августа 2014

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

    +158

    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
    function in($param) {
    	global
    		$_POST,
    		$_GET;
    
    	preg_match('#([^\[]+)(.*)#',$param,$match);
    	$match[2]=str_replace('[','["',$match[2]);
    	$match[2]=str_replace(']','"]',$match[2]);
    	$param2=eval('return htmlspecialchars(strip_tags($_POST["'.$match[1].'"]'.$match[2].'));');
    	if($param2=='' && $match[2]=='') {
    		$param2=eval('return htmlspecialchars(strip_tags($_GET["'.$match[1].'"]));');
    	}
    	return $param2;
    }

    Функция для фильтрации входящих переменных.

    berejant, 23 Августа 2014

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

    +158

    1. 1
    <?php $display=''; if ($i>1) { eval('if (!$model->photo'.$i.') {$display = "style=\"display: none;\"";}');} ?>

    Не, ну а чего? Нужно же осваивать новые функции!

    sa-kirich, 11 Августа 2014

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

    +158

    1. 1
    $_SERVER["DOCUMENT_ROOT"]    = dirname(dirname(dirname(dirname(dirname(dirname(__DIR__)))))) . '/htdocs';

    g441a, 07 Августа 2014

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

    +158

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    scope = new Object();
    scope = document.getElementById("scope");
    …
    var block = document.getElementById("scope");
    var els = block.getElementsByClassName("noactive");
    for(var n in els)
    {
    els[n].className = "active";
    }

    Проклятие, этот человек хоть что-нибудь думает, когда кодит? Хочется взять — и… Потому что мне с этим потом работать.

    torbasow, 31 Июля 2014

    Комментарии (48)
  11. PHP / Говнокод #16438

    +158

    1. 1
    2. 2
    3. 3
    4. 4
    $rs=mysql_query("
    update f_subsdetails 
    set UDate='".date ( "Y-m-d H:i:s", mktime (date("H"),date("i"),date("s"),date("m"),date("d"),date("Y")))."' 
    where username='$username'");

    Прогер наверное дорвался до изучения стандартных функции дат и времени и наверное решил закрепить знания. Наверное изучает по-алфавиту, вcкоре изучит time(), а там возможно и прочитает о втором аргументе date().

    reddevil, 29 Июля 2014

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