1. Список говнокодов пользователя Govnisti_Diavol

    Всего: 29

  2. JavaScript / Говнокод #9867

    +160

    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
    var HS_ShareButton = new Object();
    
        HS_ShareButton.Info = "ShareButton";
        
        HS_ShareButton.ShareAction = new function(hURL, hTitle, hDescription, hImage, hParams)
           {
              var hResult = '';
              var hURL = this.hURL;
              var hTitle = this.hTitle;
              var hDescription = this.hDescription;
              var hImage = this.hImage;
              var hParams = this.hParams;
              var hSendData = new Object();
              var hSendData = {hURL, hTitle, hDescription, hImage, hParams};
              
              if(hURL == null && hTitle == null && hDescription == null && hImage == null && hParams == null)
                 {
                    return hResult = 'Initialization impossible #001'; 
                 }
              else
                 {
                    HS_ShareButton._DoShare(this.hSendData);
                 }
           } 
    .... еще over 100500 строчек =]

    Это кнопка расшаривает материалы для сайта...

    Govnisti_Diavol, 05 Апреля 2012

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

    +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
    public static MyResultData SqlReturnDataset(string sql, string connection)
                {
                    MyResultData result = new MyResultData();
                    try
                    {
                        MySql.Data.MySqlClient.MySqlConnection connRC = new MySql.Data.MySqlClient.MySqlConnection(connection);
                        MySql.Data.MySqlClient.MySqlCommand commRC = new MySql.Data.MySqlClient.MySqlCommand(sql, connRC);
                        connRC.Open();
    
                        try
                        {
                            MySql.Data.MySqlClient.MySqlDataAdapter AdapterP = new MySql.Data.MySqlClient.MySqlDataAdapter();
                            AdapterP.SelectCommand = commRC;
                            DataSet ds1 = new DataSet();
                            AdapterP.Fill(ds1);
                            result.ResultData = ds1.Tables[0];
                        }
                        catch (Exception ex)
                        {
                            result.HasError = true;
                            result.ErrorText = ex.Message;
                        }
                        connRC.Close();
                    }
                    catch (Exception ex)//Этот эксепшн на случай отсутствия соединения с сервером.
                    {
                        result.ErrorText = ex.Message;
                        result.HasError = true;
                    }
                
                    return result;
    
                }

    Govnisti_Diavol, 26 Марта 2012

    Комментарии (1)
  4. JavaScript / Говнокод #9756

    +151

    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
    if(hS.reformal.val && !h.inFrame){ // добавление виджета reformal.ru для отправки багрепортов (можно то же из настроек)
    		addJs(function reformal_preload(){
    			reformal_wdg_w	= "713";
    			reformal_wdg_h	= "460";
    			reformal_wdg_domain	= "habrajax";
    			reformal_wdg_mode	= 0;
    			reformal_wdg_title   ='<a href="//userscripts.org/scripts/show/121690" target="_blank">HabrAjax</a> - чтобы сайт стал удобным';
    			reformal_wdg_ltitle  = "БАГИ";
    			reformal_wdg_lfont   = "";
    			reformal_wdg_lsize   = "";
    			reformal_wdg_color   = "#269bd1";
    			reformal_wdg_bcolor  = "#73859e";
    			reformal_wdg_tcolor  = "#FFFFFF";
    			reformal_wdg_align   = "right";
    			reformal_wdg_charset = "utf-8";
    			reformal_wdg_waction = 0;
    			reformal_wdg_vcolor  = "#559ecf";
    			reformal_wdg_cmline  = "#d3d8df";
    			reformal_wdg_glcolor  = "#105895";
    			reformal_wdg_tbcolor  = "#FFFFFF";
    			reformal_wdg_tcolor_aw4  = "#3F4543";
    			reformal_wdg_bimage = "cac7b640e87a20ba02df24d613d54a1d.png";
    			reformal_html ='';
    			document.write = function(a){reformal_html +=a;};//обход doc.write
    		});
    		addJs('http://reformal.ru/tabn2v4.js?charset=utf-8' //виджет reformal.ru и его постобработчик
    			, hS.versionNumb
    			, 'MyOtziv'
    			, function reformal_postload(){ //загрузка после doc.write и подгонка стилей, текстов
    			var elem = document.createElement('DIV');
    			elem.id ='reformal_holder';
    			elem.innerHTML = reformal_html;
    			document.body.insertBefore(elem, document.body.childNodes[0]);
    			document.getElementById('myotziv_box').style.zIndex = 3001;
    			var reformal_butt = document.querySelector('#reformal_holder .frgtd'); //кнопка открывания виджета, |.frby
    			reformal_butt.style.right='-4px';reformal_butt.style.width ='17px';
    			reformal_butt.querySelector('img').style.position='relative';
    			reformal_butt.querySelector('img').style.left='-4px';
    			reformal_butt.style.overflow ='hidden';
    			reformal_butt.querySelector('a').title ='Пожелания и баги HabrAjax';
    			reformal_butt.querySelector('a').style.marginBottom ='3em';
    			var reformal_closeButt = document.querySelector('#reformal_holder .pokusijy'); //кнопка закрытия
    			var reformal_goto = document.createElement('DIV');
    			reformal_goto.innerHTML ='<a href="http://habrajax.reformal.ru/" target="_blank">смотреть всё</a>';
    			reformal_closeButt.parentNode.insertBefore(reformal_goto, reformal_closeButt.nextSibling);
    			reformal_goto.style.cssFloat ='right';
    			reformal_goto.style.marginRight ='10px';
    			var reformal_foot1 = document.querySelector('#reformal_holder .drsdtf');
    			reformal_foot1.style.width ='auto';
    			var reformal_note1 = document.createElement('DIV');
    			reformal_note1.innerHTML ='<span title="скопируйте после клика" onclick="prompt(&quot;скопируйте для сообщения&quot;, &quot;Браузер: '+ navigator.userAgent +'; ОС: '+ navigator.platform +'; HabrAjax v. (@)&quot;)">При баге пишите <u title="'+navigator.userAgent+'">браузер</u>, <u>версию</u>, <u title="'+navigator.platform+'">ОС</u> и версию скрипта (@).</span>';
    			reformal_foot1.parentNode.appendChild(reformal_note1);
    			reformal_note1.style.padding ='3px 0 0 5px';
    			reformal_note1.style.cursor ='pointer';
    		});
    	}
    	if(hS.gPlus.val && !/\/sandbox/.test(location.href && !h.inFrame)){ // добавление скрипта Google+
    		addJs('https://apis.google.com/js/plusone.js','{"parsetags": "explicit"}', 'gapi', loadGPlus);
    	}

    =]

    Govnisti_Diavol, 25 Марта 2012

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

    +157

    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
    class UserAPI
    {
       function GetUserName($UserId)
       {
          $SqlQuery = mysql_query("SELECT UserName FROM users WHERE id='$UserId'");
          $Response = mysql_fetch_array($SqlQuery);
          return  $Response['UserName'];
       }
         
       function GetUserSurname($UserId)
       {
          $SqlQuery = mysql_query("SELECT UserSurname FROM users WHERE id='$UserId'");
          $Response = mysql_fetch_array($SqlQuery);
          return  $Response['UserSurname'];
       }
       
       function GetUserPhoto($UserId)
       {
          $SqlQuery = mysql_query("SELECT UserPhoto FROM users WHERE id='$UserId'");
          $Response = mysql_fetch_array($SqlQuery);
          return  $Response['UserPhoto'];
       }
       
       function GetUserCountry($UserId)
       {
          $SqlQuery = mysql_query("SELECT country FROM users WHERE id='$UserId'");
          $Response = mysql_fetch_array($SqlQuery);
          return  $Response['country'];
       }
    }

    О да!

    Govnisti_Diavol, 22 Марта 2012

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

    +158

    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
    class User
    {
       protected $_user_id;
       protected $_user_email;
       protected $_user_password;
     
       public function __construct($user_id)
       {
          $user_record = self::_getUserRecord($user_id);
          $this->_user_id = $user_record['id'];
          $this->_user_email = $user_record['email'];
          $this->_user_password = $user_record['password'];
       }
     
       public function __get($value) {}
       public function __set($name, $value) {}
     
       private static function _getUserRecord($user_id)
       {
          $user_record = array();
          switch($user_id) {
             case 1:
                $user_record['id'] = 1;
                $user_record['email'] = '[email protected]';
                $user_record['password'] = 'i like croissants';
                break;
     
             case 2:
                $user_record['id'] = 2;
                $user_record['email'] = '[email protected]';
                $user_record['password'] = 'me too!';
                break;
     
             case 'error':
                throw new Exception('Ошибка библиотеки SQL!');
                break;
          }
     
          return $user_record;
       }
    }
    ?>

    PHP исключения...

    Govnisti_Diavol, 19 Марта 2012

    Комментарии (6)
  7. 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)
  8. C# / Говнокод #9703

    +115

    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
    80. 80
    81. 81
    82. 82
    83. 83
    if (DialogResult.OK == openFileDialog.ShowDialog())
                {
                    CleanUp();
    
                    m_objFilterGraph = new FilgraphManager();
                    m_objFilterGraph.RenderFile(openFileDialog.FileName);
    
                    m_objBasicAudio = m_objFilterGraph as IBasicAudio;
                    
                    try
                    {
                        m_objVideoWindow = m_objFilterGraph as IVideoWindow;
                        m_objVideoWindow.Owner = (int) panel1.Handle;
                        m_objVideoWindow.WindowStyle = WS_CHILD | WS_CLIPCHILDREN;
                        m_objVideoWindow.SetWindowPosition(panel1.ClientRectangle.Left,
                            panel1.ClientRectangle.Top,
                            panel1.ClientRectangle.Width,
                            panel1.ClientRectangle.Height);
                    }
                    catch (Exception)
                    {
                        m_objVideoWindow = null;
                    }
    
                    m_objMediaEvent = m_objFilterGraph as IMediaEvent;
    
                    m_objMediaEventEx = m_objFilterGraph as IMediaEventEx;
                    m_objMediaEventEx.SetNotifyWindow((int) this.Handle,WM_GRAPHNOTIFY, 0);
    
                    m_objMediaPosition = m_objFilterGraph as IMediaPosition;
    
                    m_objMediaControl = m_objFilterGraph as IMediaControl;
    
                    this.Text = "DirectShow - [" + openFileDialog.FileName + "]";
    
                    m_objMediaControl.Run();
                    m_CurrentStatus = MediaStatus.Running;
    
                    UpdateStatusBar();
                    UpdateToolBar();
                }
            }
    
            private void CleanUp()
            {
                if (m_objMediaControl != null)
                    m_objMediaControl.Stop();
    
                m_CurrentStatus = MediaStatus.Stopped;
    
                if (m_objMediaEventEx != null)
                    m_objMediaEventEx.SetNotifyWindow(0, 0, 0);
    
                if (m_objVideoWindow != null)
                {
                    m_objVideoWindow.Visible = 0;
                    m_objVideoWindow.Owner = 0;
                }
    
                if (m_objMediaControl != null) m_objMediaControl = null;
                if (m_objMediaPosition != null) m_objMediaPosition = null;
                if (m_objMediaEventEx != null) m_objMediaEventEx = null;
                if (m_objMediaEvent != null) m_objMediaEvent = null;
                if (m_objVideoWindow != null) m_objVideoWindow = null;
                if (m_objBasicAudio != null) m_objBasicAudio = null;
                if (m_objFilterGraph != null) m_objFilterGraph = null;
            }
    
            private void menuItem4_Click(object sender, System.EventArgs e)
            {
                this.Close();
            }
    
            private void Form1_SizeChanged(object sender, System.EventArgs e)
            {
                if (m_objVideoWindow != null)
                {
                    m_objVideoWindow.SetWindowPosition(panel1.ClientRectangle.Left,
                        panel1.ClientRectangle.Top,
                        panel1.ClientRectangle.Width,
                        panel1.ClientRectangle.Height);
                }
            }

    Воспроизводим видео.
    Нестандартный путь.

    Govnisti_Diavol, 18 Марта 2012

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

    +106

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    private void ReferenceButton_Click(object sender, EventArgs e)
            {
                this.ContentBox.Controls.Remove(this.BooksPanel);
                this.ContentBox.Controls.Remove(this.LogoPanel);
                this.ContentBox.Controls.Remove(this.SearchPanel);
                this.ContentBox.Controls.Add(this.FAQPanel);
            }

    Удаляем старые контролы таким образом)
    Почти в 100% случаев найдется умник, который назовет любой код - говном.

    Govnisti_Diavol, 11 Марта 2012

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

    +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
    <?php
        
         //Get Data Base connection data:
          include "connection.php";
        
        //Data Base query class:
        class DataBaseClass
        {
            function MySQLConnect($db_user, $db_password, $db_name, $db_host)
                 {
                     $ConnectionResult = false;
                     $DATA_BASE = mysql_connect($db_host,$db_user,$db_password) 
                        or die('<div style="text-align: center; padding:40px; border: 1px solid red; font-size:20px; color: red; margin: 0 25%; width: 960px"><b>DB ERROR: </b>' . mysql_error()  .'</div>');
                     $IsConnect = mysql_select_db($db_name,$DATA_BASE)
                       or die('<div style="text-align: center; padding:40px; border: 1px solid red; font-size:20px; color: red; margin: 0 25%; width: 960px"><b>DB ERROR: </b>' . mysql_error()  .'</div>');
                    if($IsConnect == true)
                      {
                        $ConnectionResult = 1;
                        return $ConnectionResult;
                      }
                    else
                      {
                        $ConnectionResult = 0;
                        return $ConnectionResult;
                      }
                 }
        }
        
        //CreateConnection
        $Connection = new DataBaseClass();
        $Connection -> MySQLConnect($DB_USER, $DB_PASSWORD, $DB_NAME, $DB_HOST);
        
    ?>

    Самое тупое подключение к MySQL...
    Школота даже так не пишет.

    Govnisti_Diavol, 01 Марта 2012

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