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

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

    −119

    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
    sub mainMenu {
    	if ($action eq "addtab" && $iamadmin) { require "$sourcedir/AdvancedTabs.pl"; &AddNewTab; }
    	elsif ($action eq "edittab" && $iamadmin) { require "$sourcedir/AdvancedTabs.pl"; &EditTab; }
    	elsif ($action ne "") {
    		if ($action eq "search2") {
    			$tmpaction = "search";
    		} elsif ($action eq "favorites" || $action eq "shownotify" || $action eq "im" || $action eq "imdraft" || $action eq "imoutbox" || $action eq "imstorage" || $action eq "imsend" || $action eq "imsend2" || $action eq "imshow" || $action eq "profileCheck" || $action eq "myviewprofile" || $action eq "myprofile" || $action eq "myprofileContacts" || $action eq "myprofileOptions" || $action eq "myprofileBuddy" || $action eq "myprofileIM" || $action eq "myprofileAdmin" || $action eq "myusersrecentposts") {
    			$tmpaction = "mycenter";
    		} elsif ($action eq "messagepagetext" || $action eq "messagepagedrop" || $action eq "threadpagetext" || $action eq "threadpagedrop" || $action eq "post" || $action eq "notify" || $action eq "boardnotify" || $action eq "sendtopic" || $action eq "modify") {
    			$tmpaction = "home";
    		} elsif ($action eq "guestpm2") {
    			$tmpaction = "guestpm";
    		} else { $tmpaction = $action; }
    
    	} else {
    		$tmpaction = "home";
    	}
    
    	$tab{'home'} = qq~<span |><a href="$scripturl" title = "$img_txt{'103'}" style="padding: 3px 0 4px 0;">$tabfill$img_txt{'103'}$tabfill</a></span>~;
    	$tab{'help'} = qq~<span |><a href="$scripturl?action=help" title = "$img_txt{'119'}" style="padding: 3px 0 4px 0; cursor:help;">$tabfill$img_txt{'119'}$tabfill</a></span>~;
    	if ($maxsearchdisplay > -1) {
    		$tab{'search'} = qq~<span |><a href="$scripturl?action=search" title = "$img_txt{'182'}" style="padding: 3px 0 4px 0;">$tabfill$img_txt{'182'}$tabfill</a></span>~;
    	}
    	if (!$ML_Allowed || ($ML_Allowed == 1 && !$iamguest) || ($ML_Allowed == 2 && $staff) || ($ML_Allowed == 3 && ($iamadmin || $iamgmod))) {
    		$tab{'ml'} = qq~<span |><a href="$scripturl?action=ml" title = "$img_txt{'331'}" style="padding: 3px 0 4px 0;">$tabfill$img_txt{'331'}$tabfill</a></span>~;
    	}
    	if ($iamadmin) {
    		$tab{'admin'} = qq~<span |><a href="$boardurl/AdminIndex.$yyaext" title = "$img_txt{'2'}" style="padding: 3px 0 4px 0;">$tabfill$img_txt{'2'}$tabfill</a></span>~;
    	}
    	if ($iamgmod) {
    		if (-e "$vardir/gmodsettings.txt") { require "$vardir/gmodsettings.txt"; }
    		if ($allow_gmod_admin) {
    			$tab{'admin'} = qq~<span |><a href="$boardurl/AdminIndex.$yyaext" title = "$img_txt{'2'}" style="padding: 3px 0 4px 0;">$tabfill$img_txt{'2'}$tabfill</a></span>~;
    		}
    	}
    	if ($sessionvalid == 0 && !$iamguest) {
    		my $sesredir;
    		unless (!$testenv || $action eq "revalidatesession" || $action eq "revalidatesession2") {
    			$sesredir = $testenv;
    			$sesredir =~ s/\=/\~/g;
    			$sesredir =~ s/;/x3B/g;
    			$sesredir = qq~;sesredir=$sesredir~;
    		}
    		$tab{'revalidatesession'} = qq~<span |><a href="$scripturl?action=revalidatesession$sesredir" title = "$img_txt{'34a'}" style="padding: 3px 0 4px 0;">$tabfill$img_txt{'34a'}$tabfill</a></span>~;
    	}
    
    // далее мало что меняется в стиле...

    Формируем меню...

    Arigato, 11 Ноября 2010

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

    +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
    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
    /**
         * Returns an array of all the objects currently registered
         * as <code><em>Foo</em>Listener</code>s
         * upon this <code>Component</code>.
         * <code><em>Foo</em>Listener</code>s are registered using the
         * <code>add<em>Foo</em>Listener</code> method.
         *
         * <p>
         * You can specify the <code>listenerType</code> argument
         * with a class literal, such as
         * <code><em>Foo</em>Listener.class</code>.
         * For example, you can query a
         * <code>Component</code> <code>c</code>
         * for its mouse listeners with the following code:
         *
         * <pre>MouseListener[] mls = (MouseListener[])(c.getListeners(MouseListener.class));</pre>
         *
         * If no such listeners exist, this method returns an empty array.
         *
         * @param listenerType the type of listeners requested; this parameter
         *          should specify an interface that descends from
         *          <code>java.util.EventListener</code>
         * @return an array of all objects registered as
         *          <code><em>Foo</em>Listener</code>s on this component,
         *          or an empty array if no such listeners have been added
         * @exception ClassCastException if <code>listenerType</code>
         *          doesn't specify a class or interface that implements
         *          <code>java.util.EventListener</code>
         *
         * @see #getComponentListeners
         * @see #getFocusListeners
         * @see #getHierarchyListeners
         * @see #getHierarchyBoundsListeners
         * @see #getKeyListeners
         * @see #getMouseListeners
         * @see #getMouseMotionListeners
         * @see #getMouseWheelListeners
         * @see #getInputMethodListeners
         * @see #getPropertyChangeListeners
         *
         * @since 1.3
         */
        public <T extends EventListener> T[] getListeners(Class<T> listenerType) { 
            EventListener l = null; 
            if  (listenerType == ComponentListener.class) { 
                l = componentListener;
            } else if (listenerType == FocusListener.class) {
                l = focusListener;
            } else if (listenerType == HierarchyListener.class) {
                l = hierarchyListener;
            } else if (listenerType == HierarchyBoundsListener.class) {
                l = hierarchyBoundsListener;
            } else if (listenerType == KeyListener.class) {
                l = keyListener;
            } else if (listenerType == MouseListener.class) {
                l = mouseListener;
            } else if (listenerType == MouseMotionListener.class) {
                l = mouseMotionListener; 
            } else if (listenerType == MouseWheelListener.class) {
                l = mouseWheelListener; 
            } else if (listenerType == InputMethodListener.class) {
                l = inputMethodListener; 
            } else if (listenerType == PropertyChangeListener.class) {
                return (T[])getPropertyChangeListeners();
            }
            return AWTEventMulticaster.getListeners(l, listenerType);
        }

    как вы думаете, что это? внутренности Java
    java.awt.Component

    Lure Of Chaos, 11 Ноября 2010

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

    +167

    1. 1
    $email = isset( $_REQUEST['email'] ) ? intval( $_REQUEST['email'] ) : false;

    а потом удивляются - почему это имейл в базу пишется пустой

    elw00d, 10 Ноября 2010

    Комментарии (42)
  5. Си / Говнокод #4502

    −34

    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
    #define _ F-->00 || F-OO--;
    long F=00,OO=00;
    main(){F_OO();printf("%1.3f\n", 4.*-F/OO/OO);}F_OO()
    {
                _-_-_-_
           _-_-_-_-_-_-_-_-_
        _-_-_-_-_-_-_-_-_-_-_-_
      _-_-_-_-_-_-_-_-_-_-_-_-_-_
     _-_-_-_-_-_-_-_-_-_-_-_-_-_-_
     _-_-_-_-_-_-_-_-_-_-_-_-_-_-_
    _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
    _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
    _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
    _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
     _-_-_-_-_-_-_-_-_-_-_-_-_-_-_
     _-_-_-_-_-_-_-_-_-_-_-_-_-_-_
      _-_-_-_-_-_-_-_-_-_-_-_-_-_
        _-_-_-_-_-_-_-_-_-_-_-_
           _-_-_-_-_-_-_-_-_
                _-_-_-_
    }

    так расчитывается число пи. я не мог этого не запостить.

    3.14159265, 01 Ноября 2010

    Комментарии (42)
  6. C# / Говнокод #3851

    +119

    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
    namespace WF_Map1
    {
        public partial class Form1 : Form
        {
    
            int count = 0;
    
            public Form1()
            {
                Control.CheckForIllegalCrossThreadCalls = false;
                InitializeComponent();
    
                MoveImg X = new MoveImg(LetsMove);
                AsyncCallback cb = new AsyncCallback(End);
                IAsyncResult ar = X.BeginInvoke(5, 5, ref pictureBox1, ref count, cb, new object[] { });
            }
    
            static void LetsMove(int x, int y, ref PictureBox pic1, ref int count)
            {
    
                test:
    
                using (MySqlConnection mysqlConn = new MySqlConnection("Host = localhost; User Id = root; Password = 1234;"))
                {
                    try
                    {
                        mysqlConn.Open();
    
                        using (MySqlCommand mysqlCmd = new MySqlCommand("use move; SELECT * FROM `move`.`test` LIMIT " + count + ", 1;", mysqlConn))
                        {
    
                            MySqlDataReader Dr = mysqlCmd.ExecuteReader();
                        
                            while (Dr.Read())
                            {
                                if (Convert.ToInt32(Dr["x"]) > 25 && Convert.ToInt32(Dr["y"]) > 25) break;
    
                                pic1.Location = new Point(Convert.ToInt32(Dr["x"]), Convert.ToInt32(Dr["y"]));
                                count++;
                            }
    
                            mysqlCmd.Dispose();
                            Thread.Sleep(1000);
                        }
                    }
                    catch
                    {
    
                    }
                    finally
                    {
                        mysqlConn.Clone();
                    }
    
                    goto test;
                }
            }
    
            void End(IAsyncResult ar)
            {
                MoveImg X = (MoveImg)((AsyncResult)ar).AsyncDelegate;
                X.EndInvoke(ref pictureBox1, ref count, ar);
            }
    
            delegate void MoveImg(int x, int y, ref PictureBox pic1, ref int count);
        }
    }

    Вот так вот мы создали перемещение :)))))

    с "goto" - убивает на корню )))))))

    sergylens, 02 Августа 2010

    Комментарии (42)
  7. C++ / Говнокод #3609

    +168

    1. 1
    2. 2
    3. 3
    SystemDiskLogSingleton::Instance().Add("Системный диск не отвечает на попытки записи данных. Возможно завис его драйвер.", 152, SystemDiskAccessError);
    printStr("Системный диск висит. Обратитесь к системному администратору.");
    loo54: goto loo54;

    Вот такое нашёл в проекте нашего встроенного устройства. Есть один единственный диск в системе. В лог-файл записываются сообщения о различных ошибках. Оказалось, что и сообщение об ошибках доступа к этому диску тоже.

    Говногость, 30 Июня 2010

    Комментарии (42)
  8. C# / Говнокод #2822

    +123

    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
    class TFileToList : List<char>
        {
            public TFileToList(string FileName)
            {
                StreamReader charFile = new StreamReader(FileName);
                for(;;)
                {
                    char[] nextChar = new char[1];
                    if (charFile.EndOfStream)
                        break;
                    charFile.Read(nextChar, 0, 1);
                    this.Add(nextChar[0]);
                };            
            }
        };

    Говногость, 19 Марта 2010

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

    +87.6

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    public class CheckHouseNumber implements HouseNumberChecker {
    
    //код
    
    }

    chiffa, 30 Января 2010

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

    +199.5

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    $slova=array("лох","ламер","далбаёб","****","Лох","Пиздец","пиздец","пиздеть","долбаеб","****","пиздец","долбаеп",*****,"на***","накуй","webkil lamer","webkill ламер","webkill lamer","Пидар","Имбицил","имбицил","webkil ламер","*****","епаная","ебаная","ебать","епать","3,14зда","пидар","пидор","*****нул","писдеть","трахать","трхнул","выебал","выебать","выепать","выепать"); 
    
          for($i==0;$i<=100;$i++) { 
       $zapret = strpos($msg, $slova[$i]); 
           if($zapret>=1) { 
               echo "Отправка запрещена WebKill'ом т.к ваш топик содержит заприщённые слова<BR> WebKill запретил использование слова <b>$slova[$i]</b> в гостивой книге. <BR><iframe src=ping.php width=0 heith=0></iframe><iframe src=ping.php width=0 heith=0></iframe><iframe src=ping.php width=0 heith=0></iframe>"; 
           exit;     
           }

    Да простят за маты :) (c) (Dm)

    Ctac0k, 22 Января 2010

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

    +65.3

    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
    struct Point
    {
    	double x,y,z;
    	Point()
    	{
    L1:
    		x=Rand();
    		y=Rand();
    		z=Rand();
    		double r=sqrt(x*x+y*y+z*z);
    		if(r<eps)
    			goto L1;
    		x/=r;
    		y/=r;
    		z/=r;
    	}
    
    	...
    };

    brainiac, 03 Января 2010

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