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

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

    +148

    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
    ###########################################################################
    //из родительских метакурсов моего субкурса вывести те дисциплины
    //у которых есть задание
    function get_my_task_ch($subcourse_id) {
    $get_my_metacourse_ch_result = mysql_query("
    SELECT mdl_course.id, mdl_course.fullname
    FROM mdl_course, mdl_course_meta
    WHERE mdl_course.id = mdl_course_meta.parent_course
    AND mdl_course_meta.child_course = $subcourse_id
    ");  //соединить  с табличками в которых задания
    if(mysql_num_rows($get_my_metacourse_ch_result) > 0){
    		echo "<table border='1' bordercolor='#E1E1E1' style='get_my_task_ch'>";
    		echo iconv("windows-1251", "UTF-8", "<tr><th>Дисциплина</th><th>Задание</th></tr>"); 
    		 
    	$get_my_metacourse_ch_row = mysql_fetch_array($get_my_metacourse_ch_result);
    		do{
    
    			//дальше смотрим упоминаеться ли у нас этот курс в табличке mdl_course_modeules
    			$c_m_result = mysql_query("
    			SELECT mdl_course_modules.id, mdl_course_modules.module, mdl_modules.name FROM mdl_course_modules, mdl_modules
    			WHERE mdl_course_modules.course = $get_my_metacourse_ch_row[id]
    			AND mdl_course_modules.module = mdl_modules.id");
    			if(mysql_num_rows($c_m_result) > 0) {
    				$c_m_row = mysql_fetch_array($c_m_result);
    				echo "<tr><td><a href ='course/view.php?id=$get_my_metacourse_ch_row[id]'>$get_my_metacourse_ch_row[fullname]</a></td><td>";
    				do {
    					//дальше смотрим в табличку самого материала и забираем от туда необходимыйе поля
    					$task_table = mdl_.$c_m_row['name'];
    					$task_course = $get_my_metacourse_ch_row['id'];
    					$task_link = "http://localhost/moodle/moodle/mod/".$c_m_row['name']."/view.php?id=".$c_m_row['id']; //идишник берем из табличкм курс-модуль
    					$task_result = mysql_query("SELECT * FROM $task_table WHERE course = $task_course ");
    					if($task_num = mysql_num_rows($task_result) > 0) {
    					$task_row = mysql_fetch_array($task_result);
    					echo "<a href = '{$task_link}'>{$task_row[name]} ({$c_m_row['name']})</a><br/>\n";
    					
    					}
    					 
    				}
    				while($c_m_row = mysql_fetch_array($c_m_result));
    				echo"</td></tr>";
    			}
    		}
    		while($get_my_metacourse_ch_row = mysql_fetch_array($get_my_metacourse_ch_result));
    		echo "</table>";
    	}
    
    }

    ацкий писдец

    mailparen, 26 Марта 2012

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

    +62

    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
    package ru.jimbot.db;
    
    public abstract void AbstractDataBase {
    
        public AbstractDataBase {
        }
    
        public abstract void connection();
    
        public abstract void createDB();   
        
        public abstract void executeQuery();
    
        public abstract void shutdown();
    
    }

    JavaCoder, 23 Марта 2012

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

    +155

    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
    function sql_ommetr($q,&$dbt,$line)
    {
    	$result = mysql_query($q, $dbt);
    	if (!$result)
    	{
    		if (!mysql_ping($dbt))
    		{
    			$dbt = reinit_master_connection();
    			if (!mysql_ping($dbt))
    			{
    				trigger_error(__FILE__.":$line\t".mysql_errno($dbt)."\t".mysql_error($dbt)."\t| 2dieWhen executing: ".preg_replace("/\n+/"," ",$q)."\n",E_USER_WARNING);
    				die();
    			}else{
    				$result = mysql_query($q, $dbt);
    				if (!$result){
    					trigger_error(__FILE__.":$line\t".mysql_errno($dbt)."\t".mysql_error($dbt)."\t| 3dieWhen executing: ".preg_replace("/\n+/"," ",$q)."\n",E_USER_WARNING);
    					die();
    				}
    			}
    		}else{
    			$result = mysql_query($q, $dbt);
    			if (!$result){
    				trigger_error(__FILE__.":$line\t".mysql_errno($dbt)."\t".mysql_error($dbt)."\t| 3dieWhen executing: ".preg_replace("/\n+/"," ",$q)."\n",E_USER_WARNING);
    				die();
    			}
    		}
    	}
    	return $result;
    }

    Странно, я представлял себе Омметр немного иначе...

    roman-kashitsyn, 23 Марта 2012

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

    +148

    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
    <?php
    /**
     * Зиг хайль!
     *
     * @author Adolf Hitler <mein.fü[email protected]>
     * @version 1.0
     *
     * Date: 01.09.1939 14:18
     */
    
    namespace system\api\exception {
    
    	class ziga extends \Exception {
    		public function __construct($message = "Sieg Heil!", $code = 1488, \Exception $previous = NULL) {
    			parent::__construct($message, $code, $previous);
    		}
    	}
    
    }

    Сначала я нашел в проекте кусок кода throw new exception\ziga(); ...

    WinnerWolf, 23 Марта 2012

    Комментарии (7)
  6. Perl / Говнокод #9735

    −120

    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
    my $uid = 0;
    	my $parse_uid = $parse_sid->{uid} || 0;
    	my $memd_uid  = $RR::Init::memd->get('sid'.$sid) || 0;
    	# Авторизуем при помощи memd
    	if ($parse_uid==$memd_uid){
    		$uid = $memd_uid;
    	}
    
    	# Запоминаем в Куку
    	$r->pnotes('USER_SID' => $sid);
    	$param{sid} = $sid;
    	
    	# Захватываем sid
    	unless (defined $uid){
    		$RR::Init::memd->set('sid'.$sid, 0);
    	}
    	# Всяке артефакты лезут
    	$uid||=undef;

    Лезут всякие артефакты видите ли...

    PSIAlt, 22 Марта 2012

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

    +113

    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
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    if ((label1.Text == "O") & (label2.Text == "O") & (label3.Text == "O") | ((label1.Text == "X") & (label2.Text == "X") & (label3.Text == "X")))
                {
                    label1.ForeColor = Color.Red;
                    label2.ForeColor = Color.Red;
                    label3.ForeColor = Color.Red;
                    win = false;
                }
                if ((label4.Text == "O") & (label5.Text == "O") & (label6.Text == "O") | ((label4.Text == "X") & (label5.Text == "X") & (label6.Text == "X")))
                {
                    label4.ForeColor = Color.Red;
                    label5.ForeColor = Color.Red;
                    label6.ForeColor = Color.Red;
                    win = false;
                }
                if ((label7.Text == "O") & (label8.Text == "O") & (label9.Text == "O") | ((label7.Text == "X") & (label8.Text == "X") & (label9.Text == "X")))
                {
                    label4.ForeColor = Color.Red;
                    label5.ForeColor = Color.Red;
                    label6.ForeColor = Color.Red;
                    win = false;
                }
                if ((label1.Text == "O") & (label4.Text == "O") & (label7.Text == "O") | ((label1.Text == "X") & (label4.Text == "X") & (label7.Text == "X")))
                {
                    label1.ForeColor = Color.Red;
                    label4.ForeColor = Color.Red;
                    label7.ForeColor = Color.Red;
                    win = false;
                }
                if ((label2.Text == "O") & (label5.Text == "O") & (label8.Text == "O") | ((label2.Text == "X") & (label5.Text == "X") & (label8.Text == "X")))
                {
                    label2.ForeColor = Color.Red;
                    label5.ForeColor = Color.Red;
                    label8.ForeColor = Color.Red;
                    win = false;
                }
                if ((label3.Text == "O") & (label6.Text == "O") & (label9.Text == "O") | ((label3.Text == "X") & (label6.Text == "X") & (label9.Text == "X")))
                {
                    label3.ForeColor = Color.Red;
                    label6.ForeColor = Color.Red;
                    label9.ForeColor = Color.Red;
                    win = false;
                }
                if ((label1.Text == "O") & (label5.Text == "O") & (label9.Text == "O") | ((label1.Text == "X") & (label5.Text == "X") & (label9.Text == "X")))
                {
                    label1.ForeColor = Color.Red;
                    label5.ForeColor = Color.Red;
                    label9.ForeColor = Color.Red;
                    win = false;
                }
                if ((label3.Text == "O") & (label5.Text == "O") & (label7.Text == "O") | ((label3.Text == "X") & (label5.Text == "X") & (label7.Text == "X")))
                {
                    label3.ForeColor = Color.Red;
                    label5.ForeColor = Color.Red;
                    label7.ForeColor = Color.Red;
                    win = false;
                }
            }
    
            private void label7_MouseDown(object sender, MouseEventArgs e)
            {
                if (win)
                    for (int i = 0; i < 1; i++)
                    {
                        if (label7.Text == "")
                        {
                            label7.Text = "X";
    
                            if ((label1.Text == "O") & (label2.Text == "O") & (label3.Text == ""))
                            {
                                label3.Text = "O"; break;
                            }
                            if ((label1.Text == "O") & (label2.Text == "") & (label3.Text == "O"))
                            {
                                label2.Text = "O"; break;
                            }
                            if ((label1.Text == "") & (label2.Text == "O") & (label3.Text == "O"))
                            {
                                label1.Text = "O"; break;
                            }

    Крестики-нолики с одного форума. Полная версия: http://pastebin.com/59W3547n

    P4R4, 19 Марта 2012

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

    +109

    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
    namespace ChemicalLabs
    {
        public partial class MediaViewer : Form
        {
            public static string XPath;
            
            public MediaViewer(string ObjectMediaRef, string ObjectMediaName)
            {
                InitializeComponent();
    
                try
                {
                    this.Text = ObjectMediaName;
                    axWindowsMediaPlayer.settings.volume = 100;
                    ObjectMediaRef = (Convert.ToInt16(ObjectMediaRef) + 1).ToString();
                    XPath = ObjectMediaRef;
    
                    StreamReader DataStream = new StreamReader("c://ChemicalData/" + ObjectMediaRef + "/" + ObjectMediaRef + ".txt", Encoding.GetEncoding(1251));
                    _MEDIA_DATA_AREA.Text = DataStream.ReadToEnd();
    
                    
                    object[] MediaFiles = Directory.GetFiles(
                    @"c://ChemicalData/" + ObjectMediaRef + "/" + "Media", "*.mp4", SearchOption.TopDirectoryOnly);
    
                    for (int i = 0; i < MediaFiles.Length; i++)
                    {FileInfo a = new FileInfo(MediaFiles[i].ToString());MediaFilesList.Items.Add(a.Name.Remove(a.Name.Length - 4));}
                }
                
                catch (Exception Ex)
                {MessageBox.Show(Ex.ToString(),(Ex.Message).ToString(),buttons: MessageBoxButtons.OK,icon: MessageBoxIcon.Information);}
            }
    
            private void MD_Click(object sender, EventArgs e)
            {
    
                if (MediaFilesList.SelectedItem == null)
                {MessageBox.Show("Вы не выбрали материал! Просмотр невозможен.","Сами не знаете, что хотите...",buttons: MessageBoxButtons.OK,icon: MessageBoxIcon.Information);}
                else
                {
                    string MediaPath;
                    MediaPath = MediaFilesList.SelectedItem.ToString();
                    MediaPath = "c://ChemicalData/" + XPath + "/" + "Media" + "/" + MediaPath + ".mp4";
                    axWindowsMediaPlayer.close();
                    axWindowsMediaPlayer.URL = MediaPath;
                }
            }
            private void MediaStreamClose_Click(object sender, EventArgs e)
            {this.axWindowsMediaPlayer.close();}
            private void _MediaForm_Close_Click(object sender, EventArgs e)
            {this.axWindowsMediaPlayer.close(); MediaViewer.ActiveForm.Close();}
            private void MediaViewer_FormClosed(object sender, FormClosedEventArgs e)
            {this.axWindowsMediaPlayer.close();MediaViewer.ActiveForm.Close();}
            private void axWindowsMediaPlayer_MouseDownEvent(object sender, AxWMPLib._WMPOCXEvents_MouseDownEvent e)
            {MessageBox.Show("MediaPlayer - ver 0.0.1 for .NET Platform (By Kirill Sancharov)","MediaPlayer for Windows .NET",buttons: MessageBoxButtons.OK,icon: MessageBoxIcon.Information);}
     }
    }

    Удивляй меня полностью.

    Govnisti_Diavol, 19 Марта 2012

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

    +159

    1. 1
    const TWindow window(TWindowKindController::TWindowID WindowName, bool& isMainWindow=*(bool*)NULL)

    Крупный проЭкт.
    Мне кажется или с isMainWindow что-то не чисто?

    Говногость, 14 Марта 2012

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

    +162

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    if (substr(getcwd(), 0, 1) == "/") 
    {
        $div = ":";
    } // *nix system
    else 
    {
        $div = ";";
    }

    PATH_SEPARATOR? Нет, не слышал.

    travka, 11 Марта 2012

    Комментарии (7)
  11. JavaScript / Говнокод #9620

    +197

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    this.setlocale('LC_ALL',0);return text.search(this.php_js.locales[this.php_js.localeCategories.LC_CTYPE].LC_CTYPE.an)!==-1;},ctype_alpha:function(text){if(typeof text!=='string'){return false;}
    this.setlocale('LC_ALL',0);return text.search(this.php_js.locales[this.php_js.localeCategories.LC_CTYPE].LC_CTYPE.al)!==-1;},ctype_cntrl:function(text){if(typeof text!=='string'){return false;}
    this.setlocale('LC_ALL',0);return text.search(this.php_js.locales[this.php_js.localeCategories.LC_CTYPE].LC_CTYPE.ct)!==-1;},ctype_digit:function(text){if(typeof text!=='string'){return false;}
    this.setlocale('LC_ALL',0);return text.search(this.php_js.locales[this.php_js.localeCategories.LC_CTYPE].LC_CTYPE.dg)!==-1;},ctype_graph:function(text){if(typeof text!=='string'){return false;}
    this.setlocale('LC_ALL',0);return text.search(this.php_js.locales[this.php_js.localeCategories.LC_CTYPE].LC_CTYPE.gr)!==-1;},ctype_lower:function(text){if(typeof text!=='string'){return false;}
    this.setlocale('LC_ALL',0);return text.search(this.php_js.locales[this.php_js.localeCategories.LC_CTYPE].LC_CTYPE.lw)!==-1;},ctype_print:function(text){if(typeof text!=='string'){return false;}
    this.setlocale('LC_ALL',0);return text.search(this.php_js.locales[this.php_js.localeCategories.LC_CTYPE].LC_CTYPE.pr)!==-1;},ctype_punct:function(text){if(typeof text!=='string'){return false;}
    this.setlocale('LC_ALL',0);return text.search(this.php_js.locales[this.php_js.localeCategories.LC_CTYPE].LC_CTYPE.pu)!==-1;},ctype_space:function(text){if(typeof text!=='string'){return false;}
    this.setlocale('LC_ALL',0);return text.search(this.php_js.locales[this.php_js.localeCategories.LC_CTYPE].LC_CTYPE.sp)!==-1;},ctype_upper:function(text){if(typeof text!=='string'){return false;}
    this.setlocale('LC_ALL',0);return text.search(this.php_js.locales[this.php_js.localeCategories.LC_CTYPE].LC_CTYPE.up)!==-1;},ctype_xdigit:function(text){if(typeof text!=='string'){return false;}

    При беглом просмотре бросился мне тут в глаза кусочек из http://phpjs.org/downloads/php.common.min.js

    3.14159265, 06 Марта 2012

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