1. PHP / Говнокод #4930

    +158

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    while ($iii<$_POST["nnn"])
    {
    $Klass = takeYearKlass($Klass,$_POST["vipl_".$iii."ygod"]);
    print ("<br>За ".$iii."-й год было ".$_POST["vipl_".$iii."ygod"]." выплат и класс стал ".$Klass);
    $iii++;
    }
    print ("<br><b>Итоговый класс:</b> $Klass");

    В добавок к чудному явасрипту (http://govnokod.ru/4929) мне достался и сам код на php....
    В прочем там такого добра хватает))) можно и html, и css выложить)))
    Как говориться, буду писать еще))

    Zuzzuk, 15 Декабря 2010

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

    +156

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    /**
    * custom_field_sort used to sort the custom fields array
    */
    	function custom_field_sort(&$array) {
    		if(!$array) return $keys;
    
    		$keys=func_get_args();
    
    		array_shift($keys);
    		custom_field_sort_func($keys);
    		usort($array, "custom_field_sort_func");
    	}

    Файл тот же что и http://govnokod.ru/4920, просто следующая функция.

    zabuhailo, 15 Декабря 2010

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

    +163

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    class C
    {
    ...
    static function ModulesList()
    {
                    global $config;
                    return $config;
    }
    ...
    }

    ООП в действии

    elw00d, 15 Декабря 2010

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

    +36

    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
    //
                  <?php if (arg(0) == 'taxonomy' && arg(1) == 'term') {
                   $term = taxonomy_get_term(arg(2));
                   if ($term->vid == 2) { ?>
                     LCD TV Listings
                   <?php } elseif ($term->vid == 1) { ?>
                     Size LCD TV Listings
                   <?php } elseif ($term->vid == 8) { ?>
                     Questions
                   <?php } elseif ($term->vid == 10) { ?>
                     LCD TV News
                   <?php } elseif ($term->vid == 11) { ?>
                     Related LCD TV News
                   <?php } ?>
               <?php } ?>

    Вот такое прямо в шаблоне.... no comments

    brainstorm, 15 Декабря 2010

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

    +170

    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
    /**
    * custom_field_sort_func is the function that compares 2 arrays and determines the order, used by custom_field_sort
    */
    	function custom_field_sort_func($a, $b=NULL) {
    		static $keys;
    		if($b===NULL)
    			return $keys = $a;
    		foreach($keys as $k)
    		{
    			return strcmp(@$a['custom_field'][$k], @$b['custom_field'][$k]);
    		}
    		return 0;
    	}

    Из проекта написанного на движке cakephp.
    Соответствует так же содержимому самого фреймворка.

    zabuhailo, 14 Декабря 2010

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

    +157

    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
    class Tovar
    {
    var $id;
    var $idkey;
    var $parentid;
    var $clientid;
    var $categoryid;
    var $name;
    var $price;
    var $url;
    var $img_url;
    var $description;
    var $vendor;
    
    }
    
    class Category
    {
    var $id;
    var $idkey;
    var $parentid;
    var $name;
    }

    Работа с объектами в PHP4 :)) Вроде как Evolution Маркет...

    xakip, 14 Декабря 2010

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

    +163

    1. 1
    2. 2
    3. 3
    $result = mysql_query ("INSERT INTO ....");
    
    if ($result ='true') {echo "<p>Информация успешно добавлена в базу</p>";}

    С одного из форумов

    Int, 13 Декабря 2010

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

    +153

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    $cif = range(0, 9);
    $mal = range('a', 'z');
    $bol = range('A', 'Z');
    $ob = array_merge($cif, $mal, $bol);
    shuffle($ob);
    $ar = array_slice($ob,0, 5);
    $vivod = implode("", $ar);

    Очередной генератор капчи/пароля.
    Вдруг кому пригодится ;)

    Uchkuma, 12 Декабря 2010

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

    +167

    1. 1
    while(!file_exists(getcwd()."/.htroot")){chdir('..');}

    http://www.php.net/manual/en/function.require.php

    if you want always include, require, open files using some 'root' folder based path you may may put file '.htroot' in 'root' folder and use this.

    while(!file_exists(getcwd()."/.htroot")){chdir('..');}

    This code change current dir to dir where '.htroot' file located and everywhere you can use relative to 'root' paths.

    Please avoid absent of '.htroot' file.

    qbasic, 12 Декабря 2010

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

    +33

    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
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    
    <head>
    <meta http-equiv=Content-Type content="text/html; charset=windows-1251">
    <meta http-equiv="Pragma" content="no-cache">
    <link rel=File-List href="SL_php2weeks_box.files/filelist.xml">
    
    <title>PHP за 2 недели - курс обучения PHP от Школы Программирования</title>
    <style type="text/css">
    <!--
    .style1 {font-family: Georgia, "Times New Roman", Times, serif}
    .style5 {font-family: Georgia, "Times New Roman", Times, serif; font-style: italic; }
    .style6 {font-family: Georgia, "Times New Roman", Times, serif; font-weight: bold; }
    .style7 {font-family: Verdana, Arial, Helvetica, sans-serif}
    .style8 {
    	font-family: Verdana, Arial, Helvetica, sans-serif;
    	font-weight: bold;
    	font-style: italic;
    	color: #009000;
    }
    .style9 {
    	font-family: Georgia, "Times New Roman", Times, serif;
    	font-size: 18px;
    }
    .style10 {
    	font-family: "Courier New", Courier, monospace;
    	font-size: 12px;
    }
    .style11 {
    	font-size: 24px;
    	font-weight: bold;
    }
    .style12 {font-size: 24px; font-weight: bold; font-family: Georgia, "Times New Roman", Times, serif; }
    .style13 {font-size: 24px; font-weight: bold; font-family: Georgia, "Times New Roman", Times, serif; font-style: italic; }
    .style14 {font-family: Georgia, "Times New Roman", Times, serif; font-weight: bold; font-style: italic; }
    .style15 {
    	color: #0000FF;
    	font-family: Verdana, Arial, Helvetica, sans-serif;
    }
    .style17 {font-family: Georgia, "Times New Roman", Times, serif; font-style: italic; font-size: 16px; }
    .style18 {
    	font-size: 20px
    }
    -->
    </style>
    </head>
    
    
    
    <body lang=RU link=blue vlink=purple>
    
    <!-- SmartResponder.ru PopOver code (begin) -->
    <script language="javascript" type="text/javascript" src="popover.js"></script>
    <span style="margin: 0pt; padding: 0pt; width: 400px; height: 400px; position: absolute; left: 0pt; top: 0pt; right: 0pt; z-index: 1; display: none;" id="SR_PopOver">
    <table cellpadding="0" cellspacing="0" height="246" width="400">
    <tbody>
    <tr>
    <td style="border: 1px solid rgb(0, 0, 0);">
    <table bgcolor="#ffffff" cellpadding="3" cellspacing="0" height="100%" width="100%">
    <tbody>
    <tr bgcolor="#dddddd" valign="middle">
    <td onMouseDown="popover_drag_start(event, this, 'SR_PopOver')" style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 255); font-weight: bold;" align="center" width="100%">
    <b>Подарок Вам - <font style="color:#009000;">Курс Web-Старт!</font><br /> 7 Бесплатных Видеоуроков По PHP!</b></td>
    <td align="right">
    <table cellspacing="0">
    <tbody>
    
    <tr>
    <td style="padding: 0pt 3px; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10pt; color: rgb(0, 0, 0); font-weight: bold;" onClick="popover_close(this, 'popover_start_to(\'SR_PopOver\', 21, 0, \'windowWidth\', parseInt(popover_obj.style.top) - popover_base_y)')" onMouseOver="this.style.cursor='pointer'" onMouseOut="this.style.cursor='default'">X</td>
    </tr>
    </tbody>
    </table>

    http://prog-school.ru/php2weeks/

    вот как бывает! исходник страницы смотрите сами :)

    brainstorm, 11 Декабря 2010

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