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

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

    +150

    1. 1
    2. 2
    3. 3
    $stat_connect = @mysql_connect("stats.amxbans.de","amxbstats","");
    *skipped…*
    @mysql_close($stat_connect) or die(mysql_error());

    desagr, 05 Ноября 2010

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

    +73

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    private long tournamentId;
    
    /**
     * The winner takes it all
     * The loser standing small
     * Beside the victory
     * That's her destiny
     */
    private boolean theWinnerTakesItAll;

    dvb, 03 Ноября 2010

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

    +145

    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
    #ifndef __MUGCMediator_h_
    #define __MUGCMediator_h_
    
    
    
    namespace MUGClient{
      class MUGCMediator{
        public:
          MUGCMediator(void);
          ~MUGCMediator(void);
          
          MUGClient::MUGCApplication *getApplication(void);
          bool operator+(MUGClient::MUGCApplication *arg);
          //bool registerCameraController(MUGClient::MUGCCamera *arg);
        protected:
          MUGClient::MUGCApplication *clientApplication;
          //MUGClient::MUGCCamera *clientCamera;
          
      };
    };
    #endif

    fatdevil, 02 Ноября 2010

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

    −124

    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
    # Relocate
    if (open(my $reloc, "support/reloc.txt")) {
        # ...
        print "Relocating...";
        my $count = 0;
        local $_;
        while (<$reloc>) {
    	chomp;
    	my($type, $f) = split(' ', $_, 2);
    	$f = "$prefix/$f";
    	$f =~ s,/,\\,g;
    	#print "Relocating $f...\n";
    	my $read_only;
    	unless (-w $f) {
    	    $read_only++;
    	    run("\@attrib", "-r", $f);
    	}
    
    	open(my $fh, "+<", $f) || die "Can't open $f: $!";
    	binmode($fh);
    	my $content = do { local $/; <$fh> };
    
    	if ($type eq "B") {
    	    $content =~ s,\Q$sponge\E([^\0]*),$prefix$1$binary_pad,go;
    	}
    	else {
    	    $content =~ s,\Q$sponge\E,$prefix,go;
    	    $content =~ s,\Q$sponge_str\E,$prefix_str,go if $^O eq "MSWin32";
    	    truncate($fh, length($content)) || die "Can't truncate '$f': $!";
    	}
    
    	seek($fh, 0, 0) || die "Can't reset file pos on '$f': $!";
    	print $fh $content;
    	close($fh) || die "Can't write back content to '$f': $!";
    
    	run("\@attrib", "+r", $f) if $read_only;
    
    	$count++;
        }
        print "done ($count files relocated)\n";
    }

    установщик перл...
    reloc.txt содержит 137 файлов.

    seonull, 01 Ноября 2010

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

    +163

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    if ($context['make_event'])
    		echo '
    			var monthLength = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
    
    			function generateDays()
    			{
    ...
    			}';

    К сожалению, так во всем проекте..., весь HTML и JS выводиться через echo, + отсутствует нормальная логика системы..., файлов проекта over 150...

    1_and_0, 29 Октября 2010

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

    −104

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    private var color_mixer:ColorPanel = new ColorPanel([
    		[0xFFFFFF,0xEEEEEE,0xCCCCCC,0xAAAAAA,0x888888,0x666666,0x444444,0x222222,0x000000],
    		[0xFFCCCC,0xFF9999,0xFF6666,0xFF3333,0xFF0000,0xCC0000,0x990000,0x660000,0x330000],
    		[0xCCFFCC,0x99FF99,0x66FF66,0x33FF33,0x00FF00,0x00CC00,0x009900,0x006600,0x003300],
    		[0xCCCCFF,0x9999FF,0x6666FF,0x3333FF,0x0000FF,0x0000CC,0x000099,0x000066,0x000033]
    		]);

    Мне одному кажется что это можно было сделать... ну даже не знаю.... ПО ЧЕЛОВЕЧЕСКИ ????????

    KirAmp, 24 Октября 2010

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

    +148

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    function ArrayTopics() {
    	global $db;
    	$db->Select('news_topics','');
    	$top = array();
    	while($topic=$db->FetchRow()) {
    		$top[$topic['id']] = $topic;
    	}
    	return $top;
    }

    Из той же русской CMS... опять PHP костыль вместо нормального SQL запроса...

    Мартин, 24 Октября 2010

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

    +144

    1. 1
    if ((text == '' || text == '\n') && document.getElementById('log').innerHTML == '...')

    Вот такое говнецо я сделал. Надо исправить.
    Следуя лозунгу говнокода "Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!", выкладываю.

    КЭП: document.getElementById('log').innerHTML == '...' - Фэйл, не надо завязываться на содержимое.

    Oleg_quadro, 22 Октября 2010

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

    +159

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    //функция конвертации времени в таймстамп, добавлено 08.07.2010
    function convertDate($date){
    	$dateArr = explode(".", $date);
    	$date = mktime(0,0,0,$dateArr[1],$dateArr[0],$dateArr[2]);
    	return $date;
    	
    	// 21.10.2010: а чем strtotime не устраивает?
    }

    И чем strtotime() не устроило, не понятно.

    getrix, 21 Октября 2010

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

    +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
    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
    class Request_BrowserDetector
    {
      public static function singleton()
      {
        if (null === self::$_instance)
        {
          self::$_instance = new self;
        }
        
        return self::$_instance;
      }
      
      protected static $_instance = null;
    
      public function __construct()
      {
        $this->_sigs = Application::singleton()->cfg('request.browser.signatures');
      }
      
      public function detect($str)
      {
        if (isset($this->_cache[$str]))
        {
          $out = $this->_cache[$str];
        }
        else
        {
          $notFound = true;
          
          foreach ($this->_sigs as $k => $v)
          {
            if (false !== strpos($str, $k))
            {
              $out = $v;
              $notFound = false;
              break;
            }
          }
          
          if ($notFound)
          {
            $out = $this->_escape($str);
          }
          
          $this->_cache[$str] = $out;
        }
        
        return $out;
      }
      
      protected function _escape($str)
      {
        return mysql_real_escape_string($str);
      }
      
      protected $_sigs, $_cache = array();
    }

    синглетон такой, синглетон

    seonull, 20 Октября 2010

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