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

    +64.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
    public function GetRandomizedAnswers()
    	{
    		$answers = array();
    
    		if (!empty($this->answer1))
    		{
    			$answers[] = $this->answer1;
    		}
    		if (!empty($this->answer2))
    		{
    			$answers[] = $this->answer2;
    		}
    		if (!empty($this->answer3))
    		{
    			$answers[] = $this->answer3;
    		}
    		if (!empty($this->answer4))
    		{
    			$answers[] = $this->answer4;
    		}
    		if (!empty($this->answer5))
    		{
    			$answers[] = $this->answer5;
    		}
    
    		return shuffle($answers);
    	}

    guest, 28 Мая 2009

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

    +141

    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
    if ($_POST['form_submit'] == 'update_plugins') {
                $this->con->db_nofetch('DELETE FROM `blog_plugins_status` WHERE `blog_id`=\''.$this->getState('blog_id').'\' AND ( `state`=\'none\');');
    
    
                $q2 = 'UPDATE `blog_plugins_status` SET `status`=\'cancelled\' WHERE `blog_id`=\''.intval($this->blog_id).'\' AND `status`=\'semicancelled\';';
                $this->con->db_nofetch($q2);
    
                $q2 = 'UPDATE `blog_plugins_status` SET `status`=\'completed\' WHERE `blog_id`=\''.intval($this->blog_id).'\' AND `status`=\'semicompleted\';';
                $this->con->db_nofetch($q2);
    
                // updating saved versions to latest
                $update_plug_ids = implode('\', \'', $this->plugins_list_update);
                $q2 = 'UPDATE `blog_plugins_status` AS `bps` JOIN `blog_plugins` AS `bp` ON `bp`.`id` = `bps`.`plugin_id` SET `bps`.`plugin_version` = `bp`.`plugin_version` WHERE `bps`.`blog_id`=\''.intval($this->blog_id).'\' AND `bp`.`id` IN (\''.$update_plug_ids.'\');';
                $this->con->db_nofetch($q2);
            }

    sdf gsdf gsdfg

    guest, 27 Мая 2009

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

    +150

    1. 1
    if ($d != "".(double)$d)

    Говорят, что таким скриптом можно проверять данные когда принимаешь из из поля. Чтобы никто плохого не смог закинуть!

    guest, 27 Мая 2009

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

    +151

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    <?
    function br($text)
    {
        return (str_replace(Array('"',chr(13).chr(10),"\n"),Array("&quot;","<br>","<br>"),($text)));
    }
    ?>

    nl2br

    guest, 26 Мая 2009

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

    +134

    1. 1
    vse vi pidari

    oijpo

    guest, 24 Мая 2009

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

    +150

    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
    <?php
    include('myconfig.php');
    $db=mysql_connect("$host","$login","$pass") or die("error");
    $link = mysql_select_db($base,$db);
    $sql = "SELECT `ID`,`display_name`,`user_id`,`meta_value` FROM `ph_users`,`ph_usermeta` WHERE `meta_value` = 'Фотограф' ORDER by `id`";
    $result = mysql_query($sql);
    if($array = mysql_fetch_array($result)) {
    	do {
    		if ($array["meta_value"]) {
    		echo $array["display_name"]."<br />"; }
    
    	}
    while ($array = mysql_fetch_array($result)); }
    ?>

    guest, 23 Мая 2009

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

    +149

    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
    $myClass = new firstClass();
    if(!$myClass)
      echo "Ошибка";
    
    class firstClass extends secondClass{
        public function __construct()
        {
            parent::__construct();
        }
    }
    
    class secondClass{
        public function __construct()
        {
                     /* некое условие возвращающее ошибку */
            if (****)
                        return false;
        }
    }

    return в конструкторе
    (с) http://phpclub.ru/talk/showthread.php?postid=854618#post854618

    guest, 22 Мая 2009

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

    +143

    1. 1
    2. 2
    3. 3
    <?php
    // Silence is golden.
    ?>

    Wordpress wp-content/themes/index.php

    guest, 21 Мая 2009

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

    +142

    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
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
     <HEAD>
      <META http-equiv=Content-Type content="text/html; charset=windows-1251">
      <title>гЮОХЯМЮЪ ЙМХФЙЮ</title>
     </HEAD>
     <BODY bgcolor="#FFFFE0">
      <font face="Verdana" size=-1>
      <h3 align=center>Записная книжка</h3>
      <table align=center width=200>
      <p>Введите текст</p>
      <form method=post name="notebook" action="notebook.php">
       <textarea cols="30" rows="7" name="message"></textarea><br><br>
       <input type="submit" value="Написать">
      </form>
    <?php
    if (isset($_POST['message']) && !empty($_POST['message']))
    {
    	$date = date("Y-m-d H:i:s"); 
    	$s = $date ."<br>" .$_POST['message'] ."<hr>\r\n" ; 
    	$f = @fopen("notes.txt","a+") ;
    	fwrite($f,$s) ;
    	fclose($f) ; 
    }
    
    	include("notes.txt");
    
    ?>
      </table>
     </font>
    </BODY>

    Писка пишет

    guest, 21 Мая 2009

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

    +144.9

    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
    function custom_print ($custom_category, $custom_template, $aviable, $custom_from, $custom_limit, $custom_cache, $do){
      global $db, $is_logged, $member_id, $xf_inited, $cat_info, $config, $user_group, $category_id, $_TIME, $lang;
    
    
      $do = $do ? $do : "main";
      $aviable = explode ('|', $aviable);
    
      if(!(in_array($do, $aviable)) AND ($aviable[0] != "global")) return "";
    
      $custom_category  = $db->safesql(str_replace(',', '|', $custom_category));
      $custom_from = intval($custom_from);
      $custom_limit = intval($custom_limit);
      $thisdate = date ("Y-m-d H:i:s", (time()+ $config['date_adjust']*60));
    
      if (intval($config['no_date'])) $where_date = " AND date < '".$thisdate."'"; else $where_date = "";
    
      $tpl = new dle_template;
      $tpl->dir = TEMPLATE_DIR;
    
      //if ($custom_cache == "yes") $config['allow_cache'] = "yes"; else $config['allow_cache'] = false;
      if ($is_logged AND ($user_group[$member_id['user_group']]['allow_edit'] AND !$user_group[$member_id['user_group']]['allow_all_edit'])) $config['allow_cache'] = false;
    
      $content = dle_cache("custom", "cat_".$custom_category."template_".$custom_template."from_".$custom_from."limit_".$custom_limit, true);
    
      if ($content) { return $content; }
      else {
    
      $allow_list = explode (',', $user_group[$member_id['user_group']]['allow_cats']);
    
      if ($allow_list[0] != "all") {
    
        if ($config['allow_multi_category']) {
    
          $stop_list = "category regexp '[[:<:]](".implode ('|', $allow_list).")[[:>:]]' AND ";
    
        } else {
    
          $stop_list = "category IN ('".implode ("','", $allow_list)."') AND ";
    
        }
    
      } else $stop_list = "";
    
      if ($user_group[$member_id['user_group']]['allow_short']) $stop_list = "";
    
      if ($cat_info[$custom_category]['news_sort'] != "") $config['news_sort'] = $cat_info[$custom_category]['news_sort'];
      if ($cat_info[$custom_category]['news_msort'] != "") $config['news_msort'] = $cat_info[$custom_category]['news_msort'];
    
        if ($config['allow_multi_category']) {
    
          $where_category = "category regexp '[[:<:]](".$custom_category.")[[:>:]]'";
    
        } else {
    
          $custom_category = str_replace ("|", "','", $custom_category);
          $where_category = "category IN ('".$custom_category."')";
    
        }
    
        $sql_select = "SELECT " . PREFIX . "_post.id, gallery, autor, date," . PREFIX . "_post.image," . PREFIX . "_post.imgtype, short_story, full_story, " . PREFIX . "_post.xfields, title, category, alt_name, " . PREFIX . "_post.comm_num, " . PREFIX . "_post.allow_comm, allow_rate, " . PREFIX . "_post.rating, " . PREFIX . "_post.vote_num, news_read, " . PREFIX . "_post.flag, " . PREFIX . "_users.fullname FROM " . PREFIX . "_post , " . PREFIX . "_users WHERE " . PREFIX . "_post.autor=" . PREFIX . "_users.name and ".$stop_list.$where_category." AND approve = '1'".$where_date." ORDER BY ".$config['news_sort']." ".$config['news_msort']." LIMIT ".$custom_from.",".$custom_limit;
    //echo $sql_select;
      include (ENGINE_DIR.'/modules/show.custom.php');
    
        if ($config['files_allow'] == "yes")
          if ( strpos( $tpl->result['content'], "[attachment=" ) !== false)
          {
            $tpl->result['content'] = show_attach($tpl->result['content'], $attachments);
          }
    
        create_cache("custom", $tpl->result['content'], "cat_".$custom_category."template_".$custom_template."from_".$custom_from."limit_".$custom_limit, true);
    
      }
      return $tpl->result['content'];
    }

    Проект, который поддерживаю по работе просто пестрит такими вещими. Время убивает просто жуть. :((

    Мораль: Не экономьте на программистах. Не давайте студентам и дешевым фрилансерам писать проекты. Поддержка говна обойдется втридорого.

    guest, 20 Мая 2009

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