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

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

    +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
    private function incrementKey ( $key ) {
    			
    	// цепочка знаков в системе счисления
    	$sys = array_merge( range(0, 9), range('a', 'z') );
    			
    	$newKey = '';
    			
    	while( true ) {
    
    		// получаем последний символ
    		$sym = substr($key, -1);
    		$key = substr($key, 0, -1);
    					
    		if ( $sym ) {
    
    			//"инкрементируем" его
    			$cur = array_search( $sym, $sys );
    
    			if ( isset( $sys[++$cur] ) ) {
    				// всё, конец.
    				$newKey = $key . $sys[$cur] . $newKey;
    				break;
    
    			} else $newKey = $sys[0] . $newKey;
    							
    		} else {
    						
    			$newKey = $sys[0] . $newKey;
    			break;
    		}
    	}
    			
    	return $newKey;
    }

    Свежатинка

    bot-minurast, 20 Февраля 2012

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

    +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
    <?php
    iconv_set_encoding("input_encoding", "UTF-8");
    iconv_set_encoding("internal_encoding", "UTF-8");
    iconv_set_encoding("output_encoding", "UTF-8");
    
    $curl = curl_init();
    $curl_set = array(
            CURLOPT_COOKIESESSION => 0,
            CURLOPT_VERBOSE => 1,
            CURLOPT_USERAGENT => 'Opera/9.60 (J2ME/MIDP; Opera Mini/4.2.14912/812; U; ru) Presto/2.4.15',
            CURLOPT_RETURNTRANSFER => 1
        );
    
    curl_setopt_array($curl, $curl_set);
    
    for($i=1;$i<50;$i++){
        $url = 'http://utemplate.ru/load/19-1-0-'.$i;
        curl_setopt($curl, CURLOPT_URL ,$url);
        $data = curl_exec($curl);
        preg_match_all('#<div class="entrytitle">(.*)</div>(.*)<hr>#isU', $data, $matches);
        $content[title] = $matches[1][0];
        $content[desc] = $matches[2][0];
        unset($matches);
        preg_match_all('#<img src\="http://utemplate.ru/_ld/0/(.*)"/>#isU', $data, $matches);
        $content[img] = $matches[1][0];
        if($content[title] AND $content[desc] AND $content[img]){
            unset($matches);
            mkdir($content[title], 0777);
            curl_setopt($curl, CURLOPT_URL ,'http://utemplate.ru/_ld/0/'.$content[img]);
            $image = curl_exec($curl);
            curl_setopt($curl, CURLOPT_URL ,'http://utemplate.ru/load/0-0-0-'.$i.'-20');
            $file_inf = curl_exec($curl);
            preg_match_all('#<A HREF="(.*)"#isU', $file_inf, $matches);
            $ext_file = substr($matches[1][0], -4);
            $ext_img = substr($content[img], -4);
            curl_setopt($curl, CURLOPT_URL , $matches[1][0]);
            $file = curl_exec($curl);
            file_put_contents($content[title].'/'.$content[title].$ext_file, $file);
            file_put_contents($content[title].'/'.$content[title].$ext_img, $image);
            file_put_contents($content[title].'/'.$content[title].'.txt', $content[title]."\n".$content[desc]);
        }
    
    };

    Злобный самописный, рабочий граббер uCoz сайта

    __construct, 19 Февраля 2012

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

    +154

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    foreach($files as $k => $obj){
    	foreach($obj as $key => $val){
    		$temp[$val['file_sort']]=$key;	
    	}
    	ksort($temp);
    	foreach($temp as $key => $val){
    		$temp2[$val]=$obj[$val];
    	}
    	$files[$k]=$temp2;
    }

    не осилил usort(), удаляет ключи... =((

    Zyets, 10 Февраля 2012

    Комментарии (3)
  5. C++ / Говнокод #9285

    +154

    1. 1
    2. 2
    3. 3
    const inline unsigned char convert(const char c1, const char c2) const {
    	return ((c1 > '9' ? c1 - 'A' + 10 : c1 - '0') << 4) + ((c2 > '9' ? c2 - 'A' + 10 : c2 - '0') & 0xF);
    }

    Anonimous, 01 Февраля 2012

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

    +154

    1. 1
    http://habrahabr.ru/blogs/web_security/137196/

    Нанотехнологии в действии

    Spider, 28 Января 2012

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

    +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
    public function invokeMethod($method, $params = array()) {
                    switch (count($params)) {
                            case 0:
                                    return $this->{$method}();
                            case 1:
                                    return $this->{$method}($params[0]);
                            case 2:
                                    return $this->{$method}($params[0], $params[1]);
                            case 3:
                                    return $this->{$method}($params[0], $params[1], $params[2]);
                            case 4:
                                    return $this->{$method}($params[0], $params[1], $params[2], $params[3]);
                            case 5:
                                    return $this->{$method}($params[0], $params[1], $params[2], $params[3], $params[4]);
                            default:
                                    return call_user_func_array(array(&$this, $method), $params);
                    }
            }

    Из сорцов Lithium

    asfalanaft, 23 Января 2012

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

    +154

    1. 1
    <div class="futer">

    vxod, vixod и прочие шедевры. У меня глаза изливаются кровью

    brain, 18 Января 2012

    Комментарии (9)
  9. Куча / Говнокод #8866

    +154

    1. 1
    http://www.kulina.su/images/docs/Image/pirog(3).jpg

    Пирогет.КАПЧА: 9944

    dos_, 18 Декабря 2011

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

    +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
    <?
    	function lang($lang) {
    
    		$languages = array('ru', 'en', 'lv');
    	
    		foreach($languages as $lang_arr) {
    	                // Проверка, есть ли такой язык в массиве
    			if($lang == $lang_arr) {
    				// Меняем язык
    			}
    		}
    
    	}
    ?>

    in_array(); ?

    Не, не слышал... ;)

    killro0000, 15 Декабря 2011

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

    +154

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    // сохраняем лог
    $log = fopen($logfile,'w'); // открыли файл, стерев его
    foreach($temp as $tmp) {fwrite($log,trim($tmp)."n");} // каждый элемент массива записали в строку
    fclose($log); // закрыли лог
    ?>

    Зачем мне implode и file_put_contents?
    У меня нет времени, чтобы ебаться с ними! Лучше я создам цикл.

    http://forum.htmlbook.ru/index.php?showtopic=7169
    На это ссылка в топ-теме причем.

    7ion, 22 Ноября 2011

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