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

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

    +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
    var el = jQuery(this);
    	if(el.html().length<1){		
    		el.prev().find('div').addClass('over');
    		var url = jQuery(jQuery(el.prev().children()[0]).children()[1]).attr('href');
    		url = url.replace('index.php', '')+'?ajax=1';
    		//url = url.replace(/&task=[^&]+/, '&task=subcatalogs');
    
    		el.html(jQuery.ajax({
    			url: url,
    			async: false			
    		}).responseText);
    		var list = jQuery(el.children()[0]);
    		list.find('.parent').each(function(i,item){
    			jQuery(item).bind('click', catalogs_click);	
    			jQuery(item).bind('mouseover', catalogs_mouseover);
    			jQuery(item).bind('mouseout', catalogs_mouseout);
    			jQuery(item).prev().bind('mouseover', catalogs_mouseover2);
    			jQuery(item).prev().find('div').bind('mouseover', catalogs_mouseover3);
    			jQuery(item).prev().find('div a').bind('mouseover', catalogs_mouseover4);
    			jQuery(item).prev().find('div img').bind('mouseover', catalogs_mouseover5);
    		});
    		list.find('.final').each(function(i,item){
    			jQuery(item).bind('mouseover', catalogs_mouseover6).bind('mouseout', catalogs_mouseout6);
    			jQuery(item).find('div').bind('mouseover', catalogs_mouseover7).bind('mouseout', catalogs_mouseout7);
    			jQuery(item).find('div a').bind('mouseover', catalogs_mouseover8).bind('mouseout', catalogs_mouseout8);
    			jQuery(item).find('div img').bind('mouseover', catalogs_mouseover9).bind('mouseout', catalogs_mouseout9);
    		});
    		list.show();
    		
    	}else{
    		var list = jQuery(el.children()[0]);
    		if(!list.children().find('div').hasClass('over')){
    			el.prev().find('div').addClass('over');
    		}
    		list.show();
    	}

    Взялся за проект на фрилансе...

    LAKnoKAL, 19 Февраля 2014

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

    +160

    1. 1
    <a href="javascript:;" class="detail_back_link" ahref="/services_catalog/appl_list.php?SECTION=<?=$arResult["Block"]["ID"]?>"></a>

    Добавить атрибут ahref к тегу <a> ??? Фантазер-разработчик. И написать href="javascript:;"........
    Караул.

    ben, 19 Февраля 2014

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

    +51

    1. 001
    2. 002
    3. 003
    4. 004
    5. 005
    6. 006
    7. 007
    8. 008
    9. 009
    10. 010
    11. 011
    12. 012
    13. 013
    14. 014
    15. 015
    16. 016
    17. 017
    18. 018
    19. 019
    20. 020
    21. 021
    22. 022
    23. 023
    24. 024
    25. 025
    26. 026
    27. 027
    28. 028
    29. 029
    30. 030
    31. 031
    32. 032
    33. 033
    34. 034
    35. 035
    36. 036
    37. 037
    38. 038
    39. 039
    40. 040
    41. 041
    42. 042
    43. 043
    44. 044
    45. 045
    46. 046
    47. 047
    48. 048
    49. 049
    50. 050
    51. 051
    52. 052
    53. 053
    54. 054
    55. 055
    56. 056
    57. 057
    58. 058
    59. 059
    60. 060
    61. 061
    62. 062
    63. 063
    64. 064
    65. 065
    66. 066
    67. 067
    68. 068
    69. 069
    70. 070
    71. 071
    72. 072
    73. 073
    74. 074
    75. 075
    76. 076
    77. 077
    78. 078
    79. 079
    80. 080
    81. 081
    82. 082
    83. 083
    84. 084
    85. 085
    86. 086
    87. 087
    88. 088
    89. 089
    90. 090
    91. 091
    92. 092
    93. 093
    94. 094
    95. 095
    96. 096
    97. 097
    98. 098
    99. 099
    100. 100
    #include<iostream>
    #include<istream>
    #include<fstream>
    #include<string>
    using namespace std;
    const int con=100;
    const int MAX=3;
    class movie
    {
    public:
    string title;
    string genre;
    string country;
    int year;
    double gainings;
    };
    int main(); {
    {
    string* argv = new string[10]={ "Star wars", "Harry Potter" , "Lion king", "Lord of the rings" , "Evgozavur", "Cow's house" , "Snow dogs", "Ice age" , "Shrek", "Dino"};
    int n=1,gainigs=10;
    int a,b,c;
    movie film1;
    movie film2;
    movie film3;
    cout << " Enter the title:"<<endl;
    cin>>film1.title;
    cout << " Enter the genre:"<<endl;
    cin>>film1.genre;
    cout << " Enter the country:"<<endl;
    cin>>film1.dev;
    cout << " Enter the year:"<<endl;
    cin>>film1.year;
    cout << " Enter the gainings:"<<endl;
    cin>>a;
    while (a>10){
    cout << " Enter the gainings:"<<endl;
    cin>>a;
    }film1.gainings=a;
    cout<<endl<<endl<<endl;
    cout<<" Enter the title:"<<endl;
    cin>>film2.title;
    cout<<" Enter the genre:"<<endl;
    cin>>film2.genre;
    cout<<" Enter the dev:"<<endl;
    cin>>film2.dev;
    cout<< " Enter the year:"<<endl;
    cin >> film2.year;
    cout<<" Enter the gainings:"<<endl;
    cin>>b;
    while (b>10){
    cout<<" Enter the gainings:"<<endl;
    cin>>b;
    }game2.gainings=b;
    cout<<endl<<endl<<endl;
    cout<<" Enter the title:"<<endl;
    cin>>film3.title;
    cout<<" Enter the genre:"<<endl;
    cin>>film3.genre;
    cout<<" Enter the dev:"<<endl;
    cin>>film3.dev;
    cout<<" Enter the year:"<<endl;
    cin>>film3.year;
    cout<<" Enter the gainings:"<<endl;
    cin>>c;
    while (c>10){
    cout<<" Enter the gainings:"<<endl;
    cin>>c;
    }film3.gainings=c;
    for (int j=0; j<n; j++)
    {
    cout<<""<<endl;
    cout<<"Title: " <<film1.title<<endl;
    cout<<"Genre: " <<film1.genre<<endl;
    cout<<"Year: " <<film1.year<<endl;
    cout<<"Gainings: "<<film1.gainings<<endl;
    cout<<""<<endl;
    cout<< "Title: "<<film2.title<<endl;
    cout<< "Genre: "<<film2.genre<<endl;
    cout<< "Year: "<<film2.year<<endl;
    cout<< "Gainings: " << film2.gainings<<endl;
    cout<<""<<endl;
    cout<<"Title: " <<film3.title <<endl;
    cout<<"Genre: " <<film3.genre <<endl;
    cout<<"Year: " <<film3.year <<endl;
    cout<<"Gainings: "<<film3.Gainings<<endl;
    cout<<"works"<<endl;
    }
    cout<<"printing works"<<endl;
    argv[0]=film1.title;
    argv[1]=film1.genre;
    argv[2]=film1.year;
    argv[3]=film1.gainings;
    cout<<"adding works"<<endl;
    cout<<endl<<endl<<endl;
    cout<<argv[0]<<endl;
    cout<<argv[1]<<endl;cout<<argv[2]<<endl;cout<<argv[3]<<endl;
    cout<<"print after add works"<<endl;
    system("pause");
    return 0;
    }

    Из http://forums.bgdev.org/index.php?showtopic=43872

    wasde, 18 Февраля 2014

    Комментарии (2)
  5. SQL / Говнокод #14629

    −168

    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
    -- Процедура формирования таблицы анализа по FIR
    CREATE PROCEDURE KojevnikovFir
                       @DateFo varchar(10),
                       @DateTo varchar(10)
    AS DECLARE @Polet int, @ProcPolet numeric(4,2)
    -- определяю кол-во выполненных рейсов в диапазоне дат----
    SET @Polet =  (SELECT DISTINCT Count(ID)  FROM PPLS WHERE                      
      ( ( FLI_ENTRY=1 or FLI_EXIT=1 )  or   (DEP=1 and DEP_AERODROME like'UK%' )  or
      (ARR=1 and DEST_AERODROME Like'UK%')  ) and (ENTRY_TIME >=@DateFo and ENTRY_TIME <=@DateTo))
    ----------- Начало формирования таблицы FIR-------------------
    -- Создаем  SCROLL курсор 1 для чтения
    DECLARE Cursor_All_Pol CURSOR SCROLL KEYSET TYPE_WARNING FOR SELECT  Marsrut,All_Polet
    FROM Marsr_All_Pol FOR READ ONLY 
    -- Открытие курсора 1 и наполнение его данными  
    OPEN Cursor_All_Pol DECLARE @Marsrut char(11), @All_Polet int,@Count1 int,@Count1_end int
    SET @Count1=1 SET @Count1_end = @@CURSOR_ROWS 
                            -- ===========обьявляю и заполняю курсор по 2 таблице==============
                            DECLARE Cursor_Air CURSOR SCROLL KEYSET TYPE_WARNING
                            FOR SELECT  Marsrut,TYPE_AIRCRAFT,kol_TypeAir FROM Marsr_kol_Air FOR READ ONLY 
                            -- Открытие курсора 2 и наполнение его данными  
                            OPEN Cursor_Air   
                            DECLARE @MarsrutAir char(11),@Type nvarchar(4), @Air_Polet int,@Count2 int,@Count2_end int
                            SET @Count2 = 0 SET @Count2_end = @@CURSOR_ROWS 
                            -- ===========обьявляю и заполняю курсор по 3 таблице==============
                            DECLARE Cursor_AK CURSOR SCROLL KEYSET TYPE_WARNING
                            FOR SELECT  Marsrut,ICAO,AK,kol_AK FROM dbo.Marsr_kol_AK FOR READ ONLY 
                            -- Открытие курсора 2 и наполнение его данными  
                            OPEN Cursor_AK   
                            DECLARE @MarsrutAK char(11),@ICAO char(3),@AK varchar(60),@kol_AK int,@Count3 int,@Count3_end int
                            SET @Count3 = 0 SET @Count3_end = @@CURSOR_ROWS 
    -- цикл по первому курсору
    WHILE @Count1 < @Count1_end BEGIN 
    -- на 1 запись курсора 1
    FETCH NEXT FROM Cursor_All_Pol INTO @Marsrut, @All_Polet
    -- вставляю строку маршрута и кол-ва полетов в таблицу
    SET @ProcPolet = ((@All_Polet * 100)/@Polet)
    INSERT KojevnikovAnalizFIR (Marsrut,All_Polet,PrcAll,TYPE_AIRCRAFT,kol_TypeAir,ICAO,AK,kol_AK)
    VALUES (@Marsrut,@All_Polet,@ProcPolet,null,null,null,null,null)  
    SET @Count1 = @Count1 + 1 
                            -- цикл по второму курсору
                            FETCH FIRST FROM Cursor_Air INTO @MarsrutAir,@Type,@Air_Polet
                            SET @Count2 = 1
                            -- Формирую 1 строку маршрут + ВС
                            IF @Marsrut = @MarsrutAir BEGIN
                                  INSERT KojevnikovAnalizFIR (Marsrut,All_Polet,PrcAll,TYPE_AIRCRAFT,kol_TypeAir,ICAO,AK,kol_AK)
                                   VALUES (null,null,null,@Type,@Air_Polet,null,null,null)
                               END --IF  
                            WHILE @Count2 < @Count2_end BEGIN 
                            -- увеличиваю счетчик  курсора 2
                            FETCH NEXT FROM Cursor_Air INTO @MarsrutAir,@Type,@Air_Polet
                            -- Формирую строку маршрут + ВС
                            IF @Marsrut = @MarsrutAir BEGIN
                           INSERT KojevnikovAnalizFIR (Marsrut,All_Polet,PrcAll,TYPE_AIRCRAFT,kol_TypeAir,ICAO,AK,kol_AK)
                           VALUES (null,null,null,@Type,@Air_Polet,null,null,null)
                               END --IF       
                             -- закрываю цикл WHILE 2 (второй курсор)
                           SET @Count2 = @Count2 + 1
                            END   
                            -- цикл по третьему курсору
                            FETCH FIRST FROM Cursor_AK INTO @MarsrutAK,@ICAO,@AK,@kol_AK
                            SET @Count3 = 1
                            -- Формирую 1 строку маршрут + АК
                            IF @Marsrut = @MarsrutAK BEGIN
                           INSERT KojevnikovAnalizFIR (Marsrut,All_Polet,PrcAll,TYPE_AIRCRAFT,kol_TypeAir,ICAO,AK,kol_AK)
                           VALUES (null,null,null,null,null,@ICAO,@AK,@kol_AK)
                           END --IF  
                            WHILE @Count3 < @Count3_end BEGIN 
                            -- увеличиваю счетчик  курсора 3
                            FETCH NEXT FROM Cursor_AK INTO @MarsrutAK,@ICAO,@AK,@kol_AK
                            -- Формирую строку маршрут + ВС
                            IF @Marsrut = @MarsrutAK BEGIN
                           INSERT KojevnikovAnalizFIR (Marsrut,All_Polet,PrcAll,TYPE_AIRCRAFT,kol_TypeAir,ICAO,AK,kol_AK)
                           VALUES (null,null,null,null,null,@ICAO,@AK,@kol_AK)
                           END --IF       
                             -- закрываю цикл WHILE 2 (второй курсор)
                           SET @Count3 = @Count3 + 1
                            END   
    -- закрываю цикл WHILE 1 (первый курсор)
    END
                            -- Закрываю курсор 2
                            CLOSE Cursor_Air 
                            -- Удаляю курсор 1 как обьект
                            DEALLOCATE Cursor_Air
                            -- Закрываю курсор 3
                            CLOSE Cursor_AK 
                            -- Удаляю курсор 1 как обьект
                            DEALLOCATE Cursor_AK
    -- Закрываю курсор
    CLOSE Cursor_All_Pol 
    -- Удаляю курсор 1 как обьект
    DEALLOCATE Cursor_All_Pol
    ------------Конец--------------------
    GO
    select * from KojevnikovAnalizFIR 
    truncate table dbo.KojevnikovAnalizFIR
    DELETE from KojevnikovAnalizFIR
    exec dbo.KojevnikovFir '2004-01-01','2004-01-05'

    курсор головного мозга 2.1

    bahamot, 18 Февраля 2014

    Комментарии (2)
  6. SQL / Говнокод #14590

    −157

    1. 1
    2. 2
    3. 3
    4. 4
    SELECT ...
    FROM ...
    WHERE (CASE WHEN big_part = 1 AND blk_flag = 2 THEN -1 ELSE 0 END) <> -1 
    ;

    slbsomeone, 15 Февраля 2014

    Комментарии (2)
  7. Pascal / Говнокод #14572

    +96

    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
    if movcamn[1] then begin
         //
      if movcams[ 2] then begin  if Nmr= 2 then goto m1;
      if movcams[ 3] then begin  if Nmr= 3 then goto m1;
      if movcams[ 4] then begin  if Nmr= 4 then goto m1;
      if movcams[ 5] then begin  if Nmr= 5 then goto m1;
      if movcams[ 6] then begin  if Nmr= 6 then goto m1;
      if movcams[ 7] then begin  if Nmr= 7 then goto m1;
      if movcams[ 8] then begin  if Nmr= 8 then goto m1;
      if movcams[ 9] then begin  if Nmr= 9 then goto m1;
      if movcams[10] then begin  if Nmr=10 then goto m1;
      if movcams[11] then begin  if Nmr=11 then goto m1;
      if movcams[12] then begin  if Nmr=12 then goto m1;
      if movcams[13] then begin  if Nmr=13 then goto m1;
      if movcams[14] then begin  if Nmr=14 then goto m1;
      if movcams[15] then begin  if Nmr=15 then goto m1;
      if movcams[16] then begin  if Nmr=16 then goto m1;
      if movcams[17] then begin  if Nmr=17 then goto m1;
      if movcams[18] then begin  if Nmr=18 then goto m1;
      if movcams[19] then begin  if Nmr=19 then goto m1;
      if movcams[20] then begin  if Nmr=20 then goto m1;
    
      m1:   Summs1:=0;        movcams[1]:=False;   movcamn[1]:=False;
          movcam[1,1]:=False;  movcam[1,2]:=False;  movcam[1,3]:=False;  movcam[1,4]:=False;
    
            Summs2:=0;        movcams[2]:=False;   movcamn[2]:=False;
          movcam[2,1]:=False;  movcam[2,2]:=False;  movcam[2,3]:=False;  movcam[2,4]:=False;
          if Nmr=2 then goto m2;  // <---
    
            Summs3:=0;        movcams[3]:=False;   movcamn[3]:=False;
          movcam[3,1]:=False;  movcam[3,2]:=False;  movcam[3,3]:=False;  movcam[3,4]:=False;
          if Nmr=3 then goto m2;  // <---
    
            Summs4:=0;         movcams[4]:=False;   movcamn[4]:=False;
          movcam[4,1]:=False;  movcam[4,2]:=False;  movcam[4,3]:=False;  movcam[4,4]:=False;
          if Nmr=4 then goto m2;  // <---
    
            Summs5:=0;        movcams[5]:=False;   movcamn[5]:=False;
          movcam[5,1]:=False;  movcam[5,2]:=False;  movcam[5,3]:=False;  movcam[5,4]:=False;
          if Nmr=5 then goto m2;  // <---
    
            Summs6:=0;        movcams[6]:=False;   movcamn[6]:=False;
          movcam[6,1]:=False;  movcam[6,2]:=False;  movcam[6,3]:=False;  movcam[6,4]:=False;
          if Nmr=6 then goto m2;  // <---
    
            Summs7:=0;        movcams[7]:=False;   movcamn[7]:=False;
          movcam[7,1]:=False;  movcam[7,2]:=False;  movcam[7,3]:=False;  movcam[7,4]:=False;
          if Nmr=7 then goto m2;  // <---
    
            Summs8:=0;        movcams[8]:=False;   movcamn[8]:=False;
          movcam[8,1]:=False;  movcam[8,2]:=False;  movcam[8,3]:=False;  movcam[8,4]:=False;
          if Nmr=8 then goto m2;  // <---
    
            Summs9:=0;        movcams[9]:=False;   movcamn[9]:=False;
          movcam[9,1]:=False;  movcam[9,2]:=False;  movcam[9,3]:=False;  movcam[9,4]:=False;
          if Nmr=9 then goto m2;  // <---
    
                 //
            Summs10:=0;        movcams[10]:=False;   movcamn[10]:=False;
          movcam[10,1]:=False;  movcam[10,2]:=False;  movcam[10,3]:=False;  movcam[10,4]:=False;
          if Nmr=10 then goto m2;  // <---
    
            Summs11:=0;        movcams[11]:=False;   movcamn[11]:=False;
          movcam[11,1]:=False;  movcam[11,2]:=False;  movcam[11,3]:=False;  movcam[10,4]:=False;
          if Nmr=11 then goto m2;  // <---
    
            Summs12:=0;        movcams[12]:=False;   movcamn[12]:=False;
          movcam[12,1]:=False;  movcam[12,2]:=False;  movcam[12,3]:=False;  movcam[10,4]:=False;
          if Nmr=12 then goto m2;  // <---
    
            Summs13:=0;        movcams[13]:=False;   movcamn[13]:=False;
          movcam[13,1]:=False;  movcam[13,2]:=False;  movcam[13,3]:=False;  movcam[10,4]:=False;
          if Nmr=13 then goto m2;  // <---
    
            Summs14:=0;        movcams[14]:=False;   movcamn[14]:=False;
          movcam[14,1]:=False;  movcam[14,2]:=False;  movcam[14,3]:=False;  movcam[10,4]:=False;
          if Nmr=14 then goto m2;  // <---
    
            Summs15:=0;        movcams[15]:=False;   movcamn[15]:=False;
          movcam[15,1]:=False;  movcam[15,2]:=False;  movcam[15,3]:=False;  movcam[10,4]:=False;
          if Nmr=15 then goto m2;  // <---
    
            Summs16:=0;        movcams[16]:=False;   movcamn[16]:=False;
          movcam[16,1]:=False;  movcam[16,2]:=False;  movcam[16,3]:=False;  movcam[10,4]:=False;
          if Nmr=16 then goto m2;  // <---
    
            Summs17:=0;        movcams[17]:=False;   movcamn[17]:=False;
          movcam[17,1]:=False;  movcam[17,2]:=False;  movcam[17,3]:=False;  movcam[10,4]:=False;
          if Nmr=17 then goto m2;  // <---
    
            Summs18:=0;        movcams[18]:=False;   movcamn[18]:=False;
          movcam[18,1]:=False;  movcam[18,2]:=False;  movcam[18,3]:=False;  movcam[10,4]:=False;
          if Nmr=18 then goto m2;  // <---
    
            Summs19:=0;        movcams[19]:=False;   movcamn[19]:=False;
          movcam[19,1]:=False;  movcam[19,2]:=False;  movcam[19,3]:=False;  movcam[10,4]:=False;
      m2:
      end; end; end; end; end; end; end; end; end; end;   // 20 штук
      end; end; end; end; end; end; end; end; end; end;

    Попалось в одном проекте, который приходилось расчищать.
    Особенно позабавило заботливое "// 20 штук" в конце.

    qb60, 14 Февраля 2014

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

    +154

    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
    <?php
    session_start();
    include("database.php");
    include("filter.php");
    $filter = new Filter();
    isset($_GET['cat']) ? $id = $filter->Symbols($_GET['cat']) : exit("Вы зашли на страницу без параметра!");
    	
    if ( !isset($_POST['class']) && empty($_POST['class']) )
    {
    	include('header.php');
    	echo '
    		<title>Title</title>
    	';
    	include('slider.php');
    	echo '
    	<div id="Content">
    	';
    }
    
    $query_amount = $mysqli->query("SELECT COUNT(id) FROM `page_film` WHERE `genre_film`='$id' ");
    $amount_film = $query_amount->fetch_row();
    
    $query = $mysqli->query("SELECT * FROM `page_film` WHERE `genre_film`='$id' ORDER BY `id` DESC ");
    
    if ( $amount_film[0] > 0 )
    	while( $row = $query->fetch_array(MYSQLI_ASSOC) )
    		echo '
    			<div class="block-film">
    				<a class="block-link-image" href="../films/film.php?id='.$row['id'].'">
    					<img src="'.$row['poster'].'" />
    				</a>
    				<div class="block-film-text">
    					<p class="film-name">
    						<a href="../films/film.php?id='.$row['id'].'">'.$row['title'].'</a>
    					</p>
    					<p class="film-mini-name">
    						<a href="../films/film.php?id='.$row['id'].'">'.$row['desc'].'</a>
    					</p>
    					<p class="film-genre"><span>'.$row['genre'].'</span></p>
    					<p class="film-description">'.$row['description'].'</p>
    				</div>
    			</div>
    		';
    
    if ( !isset($_POST['class']) && empty($_POST['class']) )
    {
    	echo '	
    	</div>
    </body>
    </html>
    	';
    }
    ?>

    alexkor, 13 Февраля 2014

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

    +153

    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
    $db = new DB_Sql();
            $db->connect();
    		$sql = "SELECT  distinct(absnum) FROM articles";
    		$db->query($sql);
        		while ($db->next_record()){
                    $is_img_sql[] = $db->f('absnum');
                }
    		
            $Open = opendir($_SERVER['DOCUMENT_ROOT'].'/img/forall/a/');
                while(false !== ($gdir = readdir($Open))){
                    if($gdir != "." && $gdir != ".."){
                        $dir[] = $gdir;
                    }
                }
            closedir($Open);
    		
            foreach ($dir as $fdir){
                if(is_dir($_SERVER['DOCUMENT_ROOT'].'/img/forall/a/'.$fdir.'/')){
                $Open2 = opendir($_SERVER['DOCUMENT_ROOT'].'/img/forall/a/'.$fdir.'/');
                    while(false !== ($gdir2 = readdir($Open2))){
                        if($gdir2 != "." && $gdir2 != ".."){
                            $tmp = intval($fdir.ereg_replace("\..*","",$gdir2));
                            if(!in_array($tmp,$is_img_sql)){
                                $delfile = $_SERVER['DOCUMENT_ROOT'].'/img/forall/a/'.$fdir.'/'.$gdir2;
                                    if (is_file($delfile)){
                                        if (unlink($delfile)){
                                            echo "Файл <b>".$delfile."</b> удален<br>";
                                        }
                                    }
                            }
                        }
                    }
                closedir($Open2);
                }
            }
    		
            $Open = opendir($_SERVER['DOCUMENT_ROOT'].'/img/g/');
                while(false !== ($gdirg = readdir($Open))){
                    if($gdirg != "." && $gdirg != ".."){
                        $dirg[] = $gdirg;
                    }
                }
    		
            closedir($Open);
            foreach ($dirg as $fdir){
                $Open2 = opendir($_SERVER['DOCUMENT_ROOT'].'/img/g/'.$fdir.'/');
                    while(false !== ($gdir2 = readdir($Open2))){
                        if($gdir2 != "." && $gdir2 != ".."){
                            $tmp = intval($fdir.$gdir2.ereg_replace("\..*","",$gdir3));
                            if(!in_array($tmp,$is_img_sql)){
                                $delfile = $_SERVER['DOCUMENT_ROOT'].'/img/g/'.$fdir.'/'.$gdir2;
                                    if (is_dir($delfile)){
                                        $Opendel = opendir($delfile);
                                            while(false !== ($gdirdel = readdir($Opendel))){
                                                if($gdirdel != "." && $gdirdel != ".."){
                                                    $tpmdel = $delfile."/".$gdirdel;
                                                        if (is_file($tpmdel)){
                                                            unlink($tpmdel);
                                                        }
                                                }
                                            }
                                            if (rmdir($delfile)){
                                               echo "Директория <b>".$delfile."</b> удалена<br>";
                                            }
                                     }
                            }
                        }
                    }
                closedir($Open2);
            }
    		
    		$sql = "SELECT  distinct(absnum) FROM price";
    		$db->query($sql);
        		while ($db->next_record()){
                    $is_img_price[] = $db->f('absnum');
                }
            $Open = opendir($_SERVER['DOCUMENT_ROOT'].'/img/forall/p/');
                while(false !== ($gdirp = readdir($Open))){
                    if($gdirp != "." && $gdirp != ".."){
                        $dirp[] = $gdirp;
                    }
                }
            closedir($Open);
    		
            foreach ($dirp as $fdir){
                $Open2 = opendir($_SERVER['DOCUMENT_ROOT'].'/img/forall/p/'.$fdir.'/');
                    while(false !== ($gdir2 = readdir($Open2))){
                        if($gdir2 != "." && $gdir2 != ".."){
                            $tmp = intval($fdir.ereg_replace("\..*","",$gdir2));
                            if(!in_array($tmp,$is_img_price)){
                                $delfile = $_SERVER['DOCUMENT_ROOT'].'/img/forall/p/'.$fdir.'/'.$gdir2;
                                        if (is_file($delfile)){
                                            if (unlink($delfile)){
                                               echo "Файл <b>".$delfile."</b> удален<br>";
                                            }
                                        }
                            }
                        }
                    }

    shmaltorhbooks, 24 Января 2014

    Комментарии (2)
  10. Pascal / Говнокод #14394

    +141

    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
    //у стены - нахождение клеток "у стены"
    procedure useny(var vsten:bulArr);
    var i,i2:integer;
      function sh(x,y,n:integer):boolean; // n-номер сдвига n=[2..5]
      begin
      if vsten[x+sdx[n],y+sdy[n]] then sh:=true
                                  else
        if sten[x+sdx[n],y+sdy[n]] then sh:=false
                                   else
          if sten[i2+sdx[n-1],i+sdy[n-1]]or sten[i2+sdx[n+1],i+sdy[n+1]]
            then sh:=sh(x+sdx[n],y+sdy[n],n)
            else sh:=false;
      if result then vsten[x,y]:=true;
      end;
    begin
      for i:=0 to ny do
        for i2:=0 to nx do
          if not(sten[i2,i]) then
            if (sten[i2+1,i] or sten[i2-1,i])and(sten[i2,i+1] or sten[i2,i-1]) then
              begin
              vsten[i2,i]:=true;
              sh(i2,i,2);sh(i2,i,3);sh(i2,i,4);sh(i2,i,5);
              end;
    end;

    Попытка написать решатель Сокобана (Какая-то неведомая функция)

    Примечания или то, что я узнал у владельца
    1 useny - судя по всему УСтЕНЫ
    2 vsten - массив клеток Возле СТЕН
    3 sten - сами стены
    4 sh - скорее всего Шаг, но автор не уверен.
    5 sdx и sdy - СДвиг по Х и СДвиг по Y

    kegdan, 22 Января 2014

    Комментарии (2)
  11. Куча / Говнокод #14357

    +142

    1. 1
    "function"==typeof rep&&(i=rep.call(b,a,i)),typeof i){case"string":return quote(i);case"number":return isFinite(i)?String(i):"null";case"boolean":case"null":return String(i);case"object":if(!i){return"null";}if(gap+=indent,g=[],"[object Array]"===Object.prototype.toString.apply(i)){for(f=i.length,c=0;f>c;c+=1){g[c]=str(c,i)||"null";}return e=0===g.length?"[]":gap?"[\n"+gap+g.join(",\n"+gap)+"\n"+h+"]":"["+g.join(",")+"]",gap=h,e;}if(rep&&"object"==typeof rep){for(f=rep.length,c=0;f>c;c+=1){"string"==typeof rep[c]&&(d=rep[c],e=str(d,i),e&&g.push(quote(d)+(gap?": ":":")+e));}}else{for(d in i){Object.prototype.hasOwnProperty.call(i,d)&&(e=str(d,i),e&&g.push(quote(d)+(gap?": ":":")+e));}}return e=0===g.length?"{}":gap?"{\n"+gap+g.join(",\n"+gap)+"\n"+h+"}":"{"+g.join(",")+"}",gap=h,e;}}"function"!=typeof Date.prototype.toJSON&&(Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null;},String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(){return this.valueOf();});var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b","	":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;"function"!=typeof JSON.stringify&&(JSON.stringify=function(a,b,c){var d;if(gap="",indent="","number"==typeof c){for(d=0;c>d;d+=1){indent+=" ";}}else{"string"==typeof c&&(indent=c);}if(rep=b,!b||"function"==typeof b||"object"==typeof b&&"number"==typeof b.length){return str("",{"":a});}throw new Error("JSON.stringify");}),"function"!=typeof JSON.parse&&(JSON.parse=function(text,reviver){function walk(a,b){var c,d,e=a[b];if(e&&"object"==typeof e){for(c in e){Object.prototype.hasOwnProperty.call(e,c)&&(d=walk(e,c),void 0!==d?e[c]=d:delete e[c]);}}return reviver.call(a,b,e);}var j;if(text=String(text),cx.lastIndex=0,cx.test(text)&&(text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4);})),/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){return j=eval("("+text+")"),"function"==typeof reviver?walk({"":j},""):j;}throw new SyntaxError("JSON.parse");});}(),define("../vendor/json2",function(){}),define("../src/bootstrap",[],function(){var a=function(a,b){var c,d=b.split("."),e=a;c=d.length;for(var f=0;c>f;f++){"undefined"==typeof e[d[f]]&&(e[d[f]]={}),e=e[d[f]];}return e;};"undefined"==typeof BKTAG&&a(window,"BKTAG"),BKTAG.ns=a;var b={createFrame:function(a){var b=document.createElement("iframe");return b.setAttribute("name",a),b.setAttribute("id",a),b.setAttribute("title","bk"),b.style.border="0px",b.style.width="0px",b.style.height="0px","function"==typeof bk_frameLoad&&(b.onload=bk_frameLoad),b.src="javascript:void(0)",b;},checkFrame:function(a){var c="__bkframe";if("undefined"==typeof frames[c]||"undefined"==typeof document.getElementById(c)){var d=b.createFrame(c),e=document.getElementsByTagName("body")[0];e&&e.appendChild(d);}"function"==typeof a&&a();}};return b;}),define("../vendor/htmlparser",[],function(){var a=function(a){for(var b={},c=a.split(","),d=0;d<c.length;d++){b[c[d]]=!0;}return b;},b={leftTrim:function(a){return a.replace(/^\s+/,"");},startTag:/^<(\w+)((?:\s+\w+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/,endTag:/^<\/(\w+)[^>]*>/,attr:/(\w+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g,empty:a("area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,embed"),block:a("address,applet,blockquote,button,center,dd,del,dir,div,dl,dt,fieldset,form,frameset,hr,iframe,ins,isindex,li,map,menu,noframes,noscript,NOSCRIPT,object,ol,p,pre,script,SCRIPT,table,tbody,td,tfoot,th,thead,tr,ul"),inline:a("a,abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,code,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,SCRIPT,select,small,span,strike,strong,sub,sup,textarea,tt,u,var"),closeSelf:a("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr"),fillAttrs:a("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected"),special:a("script,SCRIPT,style"),one:a("html,head,body,title"),structure:{link:"head",base:"head"},htmlParser:function(a,c){function d(a,d,f,g){if(b.block[d]){for(;i.last()&&b.inline[i.last()];){e("",i.last());}}if(b.closeSelf[d]&&i.last()==d&&e("",d),g=b.empty[d]||!!g,g||i.push(d),c.start){var h=[];f.replace(b.attr,function(a,c){var d=arguments[2]?arguments[2]:arguments[3]?arguments[3]:arguments[4]?arguments[4]:b.fillAttrs[c]?c:"";h.push({name:c,value:d,escaped:d.replace(/(^|[^\\])"/g,'$1\\"')});}),c.start&&c.start(d,h,g);}}function e(a,b){if(b){for(var d=i.length-1;d>=0&&i[d]!=b;d--){}}else{var d=0;}if(d>=0){for(var e=i.length-1;e>=d;e--){c.end&&c.end(i[e]);}i.length=d;}}var f,g,h,i=[],j=a;for(i.last=function(){return this[this.length-1];};a;){if(g=!0,a=b.leftTrim(a),i.last()&&b.special[i.last()]){var k=new RegExp("</"+i.last()+">","i"),f=a.search(k),l=a.substring(0,f);l.length>0&&(c.chars&&c.chars(l),a=a.replace(l,"")),a=a.replace(k,""),e("",i.last());}else{if(0==a.indexOf("<!--")?(f=a.indexOf("-->"),f>=0&&(c.comment&&c.comment(a.substring(4,f)),a=a.substring(f+3),g=!1)):0==a.indexOf("</")?(h=a.match(b.endTag),h&&(a=a.substring(h[0].length),h[0].replace(b.endTag,e),g=!1)):0==a.indexOf("<")&&(h=a.match(b.startTag),h&&(a=a.substring(h[0].length),h[0].replace(b.startTag,d),g=!1)),g){f=a.indexOf("<");var m=0>f?a:a.substring(0,f);a=0>f?"":a.substring(f),c.chars&&c.chars(m);}}if(a==j){throw"Parse Error: "+a;}j=a;}e();},htmlToDom:function(a,c){var d=[],e=c.documentElement||c.

    ...

    bahamot, 14 Января 2014

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