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

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

    +154

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    $birthDate = "".($_POST['birthday'])."";
             //explode the date to get month, day and year
                       $birthDate = explode("/", $birthDate);
       
             //get age from date or birthdate
             $age = (date("md", date("U", mktime(0, 0, 0, $birthDate[0], $birthDate[1], $birthDate[2]))) > date("md") ? ((date("Y")-$birthDate[2])-1):(date("Y")-$birthDate[2]));

    узнайСвойВозраст,%userName%

    nonamez, 09 Августа 2013

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

    +154

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    var bl = ['Stertor'];
    $('li.hentry').each(function(){
        var elem = $(this),
            against = elem.find('p.vote > a.vote-against'),
            who = elem.find('p.author a:nth-child(2)').text();
        if(bl.indexOf(who) != -1) {
            if(against.length) against.click();
            elem.hide();
        }
    });

    "не поленись, пройдись по всем постам, и поставь каждому участнику по минусу;"
    Like this?

    russling, 11 Июля 2013

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

    +154

    1. 1
    list($V_id, $V_image, $V_title, $V_text, $V_url, $V_link_to, $V_status) = array('','','','','','','');

    множественное присваивание?! не, не слыщал

    dead_star, 08 Июля 2013

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

    +154

    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
    ......................
    if (isset ($_POST['cell121']))   {$cell121 = $_POST['cell121'];}
    else {
    $cell121 = 0;
    }
    if (isset ($_POST['cell122']))   {$cell122 = $_POST['cell122'];}
    else {
    $cell122 = 0;
    }
    if (isset ($_POST['cell123']))   {$cell123 = $_POST['cell123'];}
    else {
    $cell123 = 0;
    }
    if (isset ($_POST['cell124']))   {$cell124 = $_POST['cell124'];}
    else {
    $cell124 = 0;
    }
    if (isset ($_POST['cell125']))   {$cell125 = $_POST['cell125'];}
    else {
    $cell125 = 0;
    }
    ?>
    <!doctype html>
    <html>
    <head>
    <meta charset="utf-8">
    <link rel="stylesheet" type="text/css" href="css/style.css"/> <!--[if lt IE 9]>
    <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]--><head>
    
    
    <body>
    
    <div class="container">
    <header>   
    <?php include("page/header.php"); ?>
    </header>
    <title>Документ без названия</title>
    <?php include("page/right.php"); ?>
    <article class="content">
    <h1>Входящие</h1>
    <section>
    
    <?php
    $result = mysql_query 
    ("INSERT INTO fuckingbox (cell1,cell2,cell3,cell4,cell5,cell6,cell7,cell8,cell9,cell10,cell11,cell12,cell13,cell14,cell15,cell16,cell17,cell18,cell19,cell20,cell21,cell22,cell23,cell24,cell25,cell26,cell27,cell28,cell29,cell30,cell31,cell32,cell33,cell34,cell35,cell36,cell37,cell38,cell39,cell40,cell41,cell42,cell43,cell44,cell45,cell46,cell47,cell48,cell49,cell50,cell51,cell52,cell53,cell54,cell55,cell116,cell117,cell118,cell119,cell120,cell121,cell122,cell123,cell124,cell125) 
    VALUES ('$cell1', '$cell2', '$cell3', '$cell4', '$cell5', '$cell6', '$cell7', '$cell8', '$cell9', '$cell10', '$cell11', '$cell12', '$cell13', '$cell14', '$cell15', '$cell16', '$cell17', '$cell18', '$cell19', '$cell20', '$cell21', '$cell22', '$cell23', '$cell24', '$cell25', '$cell26', '$cell27', '$cell28', '$cell29', '$cell30', '$cell31', '$cell32', '$cell33', '$cell34', '$cell35', '$cell36', '$cell37', '$cell38', '$cell39', '$cell40', '$cell41', '$cell42', '$cell43', '$cell44', '$cell45', '$cell46', '$cell47', '$cell48', '$cell49', '$cell50', '$cell51', '$cell52', '$cell53', '$cell54', '$cell55', '$cell116', '$cell117', '$cell118', '$cell119', '$cell120', '$cell121', '$cell122', '$cell123', '$cell124', '$cell125')");
    if ($result == 'true') { echo "Ваше письмо добавлено" ;}
    else { echo "Ошибка какая то" ;}
    
    ?>

    это из реального проекта который еще умудрились продать

    durachook, 19 Июня 2013

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

    +154

    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
    $zak=$row['content']; 
        $ret=$ret.'<td>';  
        $p_ret=array();
      $t_zak=explode('{',$zak);
      $t_c=count($t_zak)-2;
    
      //------------------------------------------  
    
    for($t_i=0;$t_i<$t_c;$t_i++){
      $zak=$t_zak;
      $zak=explode('}',$zak[$t_i+2]);
      $zak=explode(';',$zak[0]);
      $p_zak=array();
      $c=(int)floor(count($zak)/2);
      $c=(int)($c*2);
      for($i=0;$i<$c;$i=$i+2){
        $temp=explode(':',$zak[$i]);
        $ind=str_replace('"','',$temp[count($temp)-1]);
        $temp=explode(':',$zak[$i+1]);
        $val=str_replace('"','',$temp[count($temp)-1]);
        $p_zak[$ind]=$val;
      }
      $p_zak['id']=(int)$p_zak['id'];
      //[count] => 3 [id] => 21 [name] => Стул [price] => 213454
      $p_ret[]='<a href="[[~'.$p_zak['id'].']]">'.$p_zak['name'].'</a> '.$p_zak['count'].' шт.';

    После модернизации одного из Интернет магазинов сломался личный кабинет ( MODX Revolution, Shopkeeper ).

    Начал изучать и понял, что прошлый программист изобрел заново unserialize.

    Rostov114, 14 Июня 2013

    Комментарии (39)
  7. JavaScript / Говнокод #13172

    +154

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    <ul>
      <script>
      $(function(){
            $(".catalog-menu ul li a[href='/newshop/cat_id:12']").parent().addClass("active");
      });
      </script>
      <li class="active">...</li>
      <li>...</li>
    </ul>

    Переделываю один магазин, выполненный на говноcms, в менюшечке увидел это.

    nkarakin, 14 Июня 2013

    Комментарии (2)
  8. JavaScript / Говнокод #13026

    +154

    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
    <script type="text/javascript">
    	// <![CDATA[
    	function update() {
    		document.calculate.totalsales.value = parseFloat(document.calculate.shoessingle.value) * parseFloat(document.calculate.socktoshoe.value) * parseFloat(document.calculate.singlepair.value);
    	}
    	// ]]>
    	
    </script>
    <script type="text/javascript">
    	// <![CDATA[
    	function amargin() {
    		document.calculate.avgmarg.value = parseFloat(document.calculate.singlepair.value) /2;
    	}
    	// ]]>
    	
    </script>
    
    
    <script type="text/javascript">
    	// <![CDATA[
    	function gmargin() {
    		document.calculate.grossmargin.value = parseFloat(document.calculate.totalsales.value) /2;
    	}
    	// ]]>
    	
    </script>

    отакота...

    padonak, 20 Мая 2013

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

    +154

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    /**
     * Загружает файл изображения, обрабатывает и добавляет в БД
     */
    function uploadPhoto($_FILES = null, $album_id = null, $ugol = null, $logo = null, $user_id = null, $hash = null) {
        $filter = new Zend_Filter_Int();
        $album_id = $filter->filter($album_id);
    
        if (empty($_FILES) or empty($album_id)) {
            return false;
        }
        ...
    }

    123qweasdzxc, 18 Мая 2013

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

    +154

    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
    I would like the language to change when a different flag icon is clicked but somehow I don't think 
    my jquery is correct because it's not working. Any guidance would be great.
    
     Thanks!
    
     <!doctype html>
     <html>
     <head>
     <meta charset="UTF-8">
     <title>Mini-Coding Assessment 5</title>
     <script src="//ajax.googleapis.com/ajax/libs/jqu… jquery.min.js"></script>
    
     <script>
     $(document).ready(function(){
     $("#images/us.png").click(function(){
     $("en").hide();
     });
     });
     </script>
    
     </head>
    
     <body>
    
     <img src="images/us.png"</a>
    
     <img src="images/it.png"</a>
    
     <img src="images/es.png"</a>
    
     <h1>How to Care for Your Cat</h1>
    
     <ul>
    
     <li>
     <div lang="en">Make sure that you take...</li></div>
    
     <li>
     <div lang="it">Assicurarsi che si prende il gatto dal veterinario...</li></div>
    
     <li>
     <div lang="es">Asegúrese de llevar a su gato al veterinario regularmente para...</li></div>
    
     </ul>
    
     </body>
     </html>

    вопрос какой-то ТП на webdeveloper.com я рыдал ))

    padonak, 17 Мая 2013

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

    +154

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    public static function checkPath($path)
    {
    	if (substr($path, -1) == '/')
    		$path = $path;
    	else
    		$path = $path.'/';
    	return $path;
    }

    facepalm.jpg

    DrFreez, 24 Марта 2013

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