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

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

    +159

    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
    <?php
    $lst=array();
    $ip_list="http://netelis.hmsite.net/loc.txt";
    $list_ip = file_get_contents($ip_list);
    if($list_ip==FALSE){ printf("Can't open file<br>\n");exit(1);}
    preg_match_all("|(?:[1-9][0-9]{0,2})\.(?:\d{1,3})\.(?:\d{1,3})\.(?:\d{1,3})|",$list_ip,$ipl);
    $i=0;
    foreach($ipl[0] as $address){
            $lst[$i++]=$address;
            $lst[$i-1].="<br />";
    }
    $lst=array_unique($lst);
    printf("Max element %d<br>\n",sizeof($lst));
    $slst=natsort($lst);
    print_r($lst);
    ?>

    Извлекает список IP-адресов, сортирует и удаляет повторяющиеся

    AliceGoth, 17 Декабря 2011

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

    +166

    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
    /*** The following methods are NOT functional
    	        They're just there to detect coding errors at compilation time ***/
    	    inline KgeRGBAVector operator + (const KgeRGBAVector &/*pVector*/) const {KgeRGBAVector lNullVector; return lNullVector;}
            inline KgeRGBAVector operator - (const KgeRGBAVector &/*pVector*/) const {KgeRGBAVector lNullVector; return lNullVector;}
            inline KgeRGBAVector operator * (const KgeRGBAVector &/*pVector*/) const {KgeRGBAVector lNullVector; return lNullVector;}
            inline double  operator ^ (const KgeRGBAVector &/*pVector*/) const {return 0.0;}
            inline KgeRGBAVector &operator += (const KgeRGBAVector &/*pVector*/) {return *this;}
            inline KgeRGBAVector &operator -= (const KgeRGBAVector &/*pVector*/) {return *this;}
            inline KgeRGBAVector &operator *= (const KgeRGBAVector &/*pVector*/) {return *this;}
    
            inline KgeRGBAVector operator * (double /*pScalar*/) const {KgeRGBAVector lNullVector; return lNullVector;}
            inline KgeRGBAVector operator / (double /*pScalar*/) const {KgeRGBAVector lNullVector; return lNullVector;}
            inline KgeRGBAVector &operator *= (double /*pScalar*/) {return *this;}
            inline KgeRGBAVector &operator /= (double /*pScalar*/) {return *this;}

    Говнокод или гениально? Дискас.

    makc3d, 17 Декабря 2011

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

    −126

    1. 1
    2. 2
    3. 3
    4. 4
    Config.createErrorSkin = function (data:*):IPlayerSkin
    {
    	return new PlayerSkinPromoDjVideoErrorLoadConfState(stage.stageWidth, stage.stageHeight, data);
    }

    kyzi007, 13 Декабря 2011

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

    −103

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    class Person < ActiveRecord::Base  
    def self.current=(person)
        @current_people = person
      end
      def self.current
        @current_people
      end
    end

    Определяют текущего пользователя в модели=)

    opak, 10 Декабря 2011

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

    +167

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    if (!$xhr)
    {
    	//...
    } 
    else
    {
    	echo $goodUpload ? 'ok' : 'ne ok';							
    }

    Ответ формы на AJAX-запрос

    f0rm4t, 06 Декабря 2011

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

    +167

    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
    #top1
        	if($this->space == "slot1")
        	{
        		$pos = new Rennab();
        		$this->size = $pos->getSizes('slot1');
        		
        		$this->content = Doctrine::getTable('Rennab')->createQuery('a')
                        ->where('a.position = ?', array('slot1'))
        		    ->orderBy('RAND()')
        		    ->fetchOne();
        	}
    
    #top2
        	if($this->space == "slot2")
        	{
        		$pos = new Rennab();
        		$this->size = $pos->getSizes('slot2');
        		
        		$this->content = Doctrine::getTable('Rennab')->createQuery('a')
                            ->leftJoin('a.Photo ph')
        		        ->where('a.position = ?', array('slot2'))
        		        ->orderBy('RAND()')
        		        ->fetchOne();
    
        	}
    #top3
        	if($this->space == "slot3")
        	{
        		$pos = new Rennab();
        		$this->size = $pos->getSizes('slot3');
        		
        		$this->content = Doctrine::getTable('Rennab')->createQuery('r')
                            ->leftJoin('r.Photo ph')
        		        ->where('r.position = ?', array('slot3'))
        		        ->orderBy('RAND()')
        		        ->fetchOne();
    
        	}

    А говорят, что только индусы так делают....

    temkin, 25 Ноября 2011

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

    +147

    1. 1
    2. 2
    Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь?
    Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!

    >выдавили

                Уж понятно, что не руками.

    TarasGovno, 24 Ноября 2011

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

    +161

    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
    <?php
    /**
     * Cleaning Input Script
     * Copyright 2009 - www.pgmr.co.uk - [email protected]
     */
    function clean($str) {
    	if(!get_magic_quotes_gpc()) {
     	$str = addslashes($str);
     }
    	$str = strip_tags(htmlspecialchars($str));
    	return $str;
    }
    ?>

    "Универсальная функция для защиты сайта от XSS, SQL и JS-инъекций."
    http://2lx.ru/2011/04/funkciya-dlya-zashhity-sajta-ot-vzloma/

    jokz, 19 Ноября 2011

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

    +159

    1. 1
    if($_GET['archive'] and $_GET['archive'] != ''){ $archive = $_GET['archive']; } // stupid fix ?

    cutenews

    jQuery, 11 Ноября 2011

    Комментарии (9)
  11. C++ / Говнокод #8474

    +168

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    QTime time;
    
    QString name =  (time.currentTime()).toString();
    
    for (int i = 2; i <= 5; i = i+3)
    {
    	name.remove(i,1);
    	name.insert(i,".");
    }

    вот так вот, ребятишки.

    bartimeus33nt10, 10 Ноября 2011

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