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

    +176

    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 convert_date($date) {
        $part_date = explode(" ", $date);
        $part_day = explode("-", $part_date[0]);
        $year = $part_day[0];
        $month = $part_day[1];
        $day = $part_day[2];
        $part_time = explode(":", $part_date[1]);
        $hour = $part_time[0];
        $min = $part_time[1];
        $result = $day . "." . $month . "." . $year;
        return $result;
    }

    Трудное решение легких проблем

    eugene111222, 27 Февраля 2014

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

    +175

    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
    $select_from = false;
    		if ($_GET['news_id']){
    			$this_id = (int)htmlspecialchars($_GET['news_id']);
    			$select_from = "news";
    		}
    		if ($_GET['article_id']){
    			$this_id = (int)htmlspecialchars($_GET['article_id']);
    			$select_from = "articles";
    		}
    		if ($_GET['articles_id']){
    			$this_id = (int)htmlspecialchars($_GET['articles_id']);
    			$select_from = "articles";
    		}
    		
    		$w = mysql_fetch_assoc(mysql_query("SELECT * FROM `".$getdata['pref'].$select_from."` WHERE `id` = \"{$this_id}\" LIMIT 1"));

    good_web_master, 27 Февраля 2014

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

    +175

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    if(!$item["region"])
    	$item["region"] = "Москва";
    
    	if($item["region"])
    	$text = str_replace('<option>'.$item["region"].'</option>', '<option value="'.$item["region"].'" selected>'.$item["region"].'</option>', $text);

    Гениальнейшая простановка selected для выбранного option в форме

    kindofbear, 27 Февраля 2014

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

    +182

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    if($valuta=='rur') {
    	$rate = "RUR";
    } else {
    	$rate = strtoupper($valuta);
    }

    draug, 27 Февраля 2014

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

    +141

    1. 1
    Ну не суки?

    Konardo, 27 Февраля 2014

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

    +140

    1. 1
    Я не понял - какого хуя удалили все мои посты?

    Konardo, 27 Февраля 2014

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

    +133

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    //Смешались в кучу кони, люди...
    //знаю, что не комильфо писать запрос в контролере, но уже поссрать... ("поССрать", © 2014, Gary)
    $tempo = $this->db->query("SELECT `price_lists`.`id`, `companies`.`company_id`, `companies`.`name`  FROM `price_lists` LEFT JOIN `companies` ON `companies`.`company_id` = `price_lists`.`postovchik_id`")->result();
    $data['pricelistzgrrrrrrrrrr'] = array();
    if (is_array($tempo) && count($tempo)) {
        foreach ($tempo as $postovchik) {
            $data['pricelistzgrrrrrrrrrr'][$postovchik->id] = $postovchik->name;
        }
    }

    Gary, 27 Февраля 2014

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

    +177

    1. 1
    2. 2
    $lists['arrDateYear']=array(2000=>2000,2001=>2001,2002=>2002,2003=>2003,2004=>2004,2005=>2005,2006=>2006,2007=>2007,2008=>2008,2009=>2009,2010=>2010);
    $lists['arrDateDay']=array(1=>1,2=>2,3=>3,4=>4,5=>5,6=>6,7=>7,8=>8,9=>9,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);

    1=1

    Merisho, 26 Февраля 2014

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

    +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
    $infopage = file_get_contents("http://instagram.com/api/v1/users/".$match."/info/", false, $context);
    $isprivate = substr($infopage,strpos($infopage,',"is_private":')+14,strpos($infopage,',"external_url":"')-strpos($infopage,',"is_private":')-14);
    $fullname = substr($infopage,strpos($infopage,'","full_name":"')+15,strpos($infopage,'","follower_count":')-strpos($infopage,'","full_name":"')-15);
    $mediacount = substr($infopage,strpos($infopage,',"media_count":')+15,strpos($infopage,',"following_count":')-strpos($infopage,',"media_count":')-15);
    $following = substr($infopage,strpos($infopage,',"following_count":')+19,strpos($infopage,',"geo_media_count":')-strpos($infopage,',"following_count":')-19);
    $isint2 = is_numeric($following);
    if ($isint2 == false){$following = substr($infopage,strpos($infopage,',"following_count":')+19,strpos($infopage,',"profile_pic_url":"')-strpos($infopage,',"following_count":')-19);}
    $followers = substr($infopage,strpos($infopage,',"follower_count":')+18,strpos($infopage,',"pk":')-strpos($infopage,',"follower_count":')-18);
    $avatar = stripslashes(substr($infopage,strpos($infopage,'"profile_pic_url":"')+19,strpos($infopage,'","biography":"')-strpos($infopage,'"profile_pic_url":"')-19));
    $bio = substr($infopage,strpos($infopage,'","biography":')+15,strpos($infopage,'","full_name":"')-strpos($infopage,'","biography":')-15);
    $website = stripslashes(substr($infopage,strpos($infopage,'"external_url":"')+16,strpos($infopage,'"}}')-strpos($infopage,'"external_url":"')-16));
    $countq = mysql_query("SELECT COUNT(*) FROM `links` WHERE `ownerID` = '".$match."'");
    $countf = mysql_fetch_array($countq);

    Парсинг API Instagram. JSON - слишком неправославно, да.

    olenyash, 26 Февраля 2014

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

    +151

    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
    $s = $this->getAdapter()->select()->from(array('b' => $this->info('name'), array(
       'text',
       'link',
       'image',
                'show_register',
    
    
      )))->joinInner(array('s' => 'banner_size'), 's.id=b.size_id', array('x', 'y'))
       ->where('b.show_it = ?', 1)
       ->where('s.x = ?', $sizeX)
       ->where('s.y = ?', $sizeY)
       ->limit(1)
       ->order('RAND()');
    
    
            if (!empty($uid)){
                $s->where('(b.show_register= ?, 1)' OR '(b.show_register= ?, 0)');
            } else {
                $s->where('(b.show_register= ?, -1)' OR '(b.show_register= ?, 0)');
    
            }
          echo $s-> __toString();
          //  var_dump(!empty($uid));
      return $this->getAdapter()->fetchRow($s);

    мега крутое условие
    $s->where('(b.show_register= ?, 1)' OR '(b.show_register= ?, 0)');

    kolyabres, 25 Февраля 2014

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