1. PHP / Говнокод #242

    +23.3

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    public function logout()
    
        {
    
            $_SESSION = array();
    
            session_unset();
    
            session_destroy();
    
            setcookie("username", "", time() - 3600, "/", '.'.BASE_HTTP_HOST);
    
            setcookie("password", "", time() - 3600, "/", '.'.BASE_HTTP_HOST);
    
        }

    Это чтоб уж наверняка, стереть сессию, так стереть...

    guest, 22 Декабря 2008

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

    +16.6

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    if (e.PosChanged != PosChanged.Moved)
    {
          if (e.PosChanged == PosChanged.Sized && e.ColumnHeaders[0].Column.Key == Column.SelectedColumnName)
          {
                  return;
          }
    
          return;
    }
    string key = e.ColumnHeaders[0].Column.Key;
    //....

    guest, 22 Декабря 2008

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

    +15.8

    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
    public void Discard(Answer answer)
            {
                RecordedAnswer discardedAnswer = null;
                foreach (RecordedAnswer recodedAnswer in m_recodedAnswers)
                {
                    if (object.ReferenceEquals(recodedAnswer, answer))
                    {
                        discardedAnswer = recodedAnswer;
                        break;
                    }
                }
                if (null != discardedAnswer)
                {
                    m_recodedAnswers.Remove(discardedAnswer);
                }
            }

    Прикол в том, что Answer и RecordedAnswer есть разные классы, никак не связанные наследованием, оба отнаследованы от Object

    guest, 22 Декабря 2008

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

    +71

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    <?
    if ($_SESSION['UsersPermission'] != 'admin') {?>
        <script type = "text/javascript">
            location.href = "index.php";
        </script>
    <?}

    Мега безопасная проверка на права админа

    guest, 21 Декабря 2008

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

    +14

    1. 1
    ';alert(0)//\';alert(1)//";alert(2)//\";alert(3)//--></SCRIPT>"">'><SCRIPT>alert(4)</SCRIPT>=&{}"");}alert(6);function xss(){//"

    ';alert(0)//\';alert(1)//";alert(2)//\";alert(3)//--></SCRIPT>"">'><SCRIPT>alert(4)</SCRIPT>=&{}"");}alert(6);function xss(){//"

    guest, 21 Декабря 2008

    Комментарии (4)
  6. ActionScript / Говнокод #236

    −567.3

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    do {
    
    	t_year++;
    
    	Length_periods[i]++;
    
    
    } while (t_year<=Periods_end);

    А вам слабо!?

    guest, 21 Декабря 2008

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

    −41

    1. 1
    flag = bool(int(flag) - 1);

    guest, 21 Декабря 2008

    Комментарии (3)
  8. Pascal / Говнокод #234

    −186.9

    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
    for J1:=0 to Length(wArTypCoil[JJ])-1 do begin
          with wArTypCoil[JJ][J1] do begin
           with cTyp_coil do begin NRow:=J1+1;NTab:=II_Tabl+4; Itm5:=II;StrN:=2230;mEd:=true;Lev:=2;end;P5;ArP5[IJ5]:=@cTyp_coil;inc(IJ5);inc(II);
           with cD_in do begin NRow:=J1+1;NTab:=II_Tabl+4; Itm1:=II; StrN:=2231;mEd:=true;NPos:=1;Lev:=2;end;P1;ArP1[IJ1]:=@cD_in;inc(IJ1);inc(II);
           with cTyp_pr do begin NRow:=J1+1;NTab:=II_Tabl+4; Itm6:=II;NTypChs1:=1;StrN:=2232;mEd:=true;Lev:=2;end;P6;ArP6[IJ6]:=@cTyp_Pr;inc(IJ6);inc(II);
           with cRad_str do begin NRow:=J1+1;NTab:=II_Tabl+4; Itm5:=II; StrN:=2233;mEd:=true;Lev:=2;end;P5;ArP5[IJ5]:=@cRad_str;inc(IJ5);inc(II);
           with cPW_coil_rad do begin NRow:=J1+1;NTab:=II_Tabl+4; Itm2:=II; StrN:=2235;mEd:=true;Lev:=2;end;P2;ArP2[IJ2]:=@cPW_coil_rad;inc(IJ2);inc(II);
           with cPW_coil_os do begin NRow:=J1+1;NTab:=II_Tabl+4; Itm2:=II; StrN:=2248;mEd:=true;Lev:=2;end;P2;ArP2[IJ2]:=@cPW_coil_os;inc(IJ2);inc(II);
           with cRat_cur do begin NRow:=J1+1;NTab:=II_Tabl+4; Itm1:=II; StrN:=2236;mEd:=true;NPos:=2;Lev:=2;end;P1;ArP1[IJ1]:=@cRat_cur;inc(IJ1);inc(II);
           with cTrn_coil do begin NRow:=J1+1;NTab:=II_Tabl+4; Itm1:=II; StrN:=2237;mEd:=true;NPos:=3;Lev:=2;end;P1;ArP1[IJ1]:=@cTrn_coil;inc(IJ1);inc(II);
           with cRad_dim do begin NRow:=J1+1;NTab:=II_Tabl+4; Itm1:=II; StrN:=2271;mEd:=true;NPos:=3;Lev:=2;end;P1;ArP1[IJ1]:=@cRad_dim;inc(IJ1);inc(II);
           //...
          end;
         end;
         with wArNconcentr[JJ] do begin NRow:=1;NTab:=II_Tabl+1; Itm2:=II; StrN:=2279;mEd:=false;Lev:=1;end;P2;ArP2[IJ2]:=@wArNconcentr[JJ];inc(IJ2);inc(II);
         with wArM_c[JJ] do begin NRow:=1;NTab:=II_Tabl+1; Itm3:=II; StrN:=2316;mEd:=true;NPos:=0;Lev:=1;end;P3;ArP3[IJ3]:=@wArM_c[JJ];inc(IJ3);inc(II);
     //    with wArNumZoneOtvod_c[JJ] do begin NTab:=II_Tabl+1; Itm3:=II; StrN:=2317;mEd:=true;NPos:=0;Lev:=1;end;P3;ArP3[IJ3]:=@wArNumZoneOtvod_c[JJ];inc(IJ3);inc(II);
     //    with wArNumZoneVdod_c[JJ] do begin NTab:=II_Tabl+1; Itm3:=II; StrN:=2318;mEd:=true;NPos:=0;Lev:=1;end;P3;ArP3[IJ3]:=@wArNumZoneVdod_c[JJ];inc(IJ3);inc(II);
     //    with wArNxod_c[JJ] do begin NTab:=II_Tabl+1; Itm3:=II; StrN:=2319;mEd:=true;NPos:=0;Lev:=1;end;P3;ArP3[IJ3]:=@wArNxod_c[JJ];inc(IJ3);inc(II);
     //    with wArNcur_c[JJ] do begin NTab:=II_Tabl+1; Itm3:=II; StrN:=2320;mEd:=true;NPos:=0;Lev:=1;end;P3;ArP3[IJ3]:=@wArNcur_c[JJ];inc(IJ3);inc(II);
     //    with wArParam_c[JJ] do begin NTab:=II_Tabl+1; Itm3:=II; StrN:=2321;mEd:=true;NPos:=0;Lev:=1;end;P3;ArP3[IJ3]:=@wArParam_c[JJ];inc(IJ3);inc(II);
     //    with wArSw_c[JJ] do begin NTab:=II_Tabl+1; Itm3:=II; StrN:=2322;mEd:=true;NPos:=1;Lev:=1;end;P3;ArP3[IJ3]:=@wArSw_c[JJ];inc(IJ3);inc(II);
         with wArNumKolc_top_c[JJ] do begin NRow:=1;NTab:=II_Tabl+1; ; Itm3:=II; StrN:=2328;mEd:=true;NPos:=0;Lev:=1;end;P3;ArP3[IJ3]:=@wArNumKolc_top_c[JJ];inc(IJ3);inc(II);
         with wArNumKolc_bot_c[JJ] do begin NRow:=1;NTab:=II_Tabl+1; Itm3:=II; StrN:=2329;mEd:=true;NPos:=0;Lev:=1;end;P3;ArP3[IJ3]:=@wArNumKolc_bot_c[JJ];inc(IJ3);inc(II);
         with wArNreek_ar[JJ] do begin NRow:=1;NTab:=II_Tabl+3; Itm3:=II; StrN:=2313;mEd:=true;NPos:=0;Lev:=1;end;P3;ArP3[IJ3]:=@wArNreek_ar[JJ];inc(IJ3);inc(II);
         with wArGshreik_ar[JJ] do begin NRow:=1;NTab:=II_Tabl+3; Itm3:=II; StrN:=2314;mEd:=true;NPos:=2;Lev:=1;end;P3;ArP3[IJ3]:=@wArGshreik_ar[JJ];inc(IJ3);inc(II);
         with wArGtreik_ar[JJ] do begin NRow:=1;NTab:=II_Tabl+3; Itm3:=II; StrN:=2315;mEd:=true;NPos:=2;Lev:=1;end;P3;ArP3[IJ3]:=@wArGtreik_ar[JJ];inc(IJ3);inc(II);
         with wArShreik_ar[JJ] do begin NRow:=1;NTab:=II_Tabl+3; Itm3:=II; StrN:=2404;mEd:=true;NPos:=2;Lev:=1;end;P3;ArP3[IJ3]:=@wArShreik_ar[JJ];inc(IJ3);inc(II);
         with wArNpr[JJ] do begin NRow:=1;NTab:=II_Tabl+3; Itm2:=II; StrN:=2369;mEd:=true;Lev:=1;end;P2;ArP2[IJ2]:=@wArNpr[JJ];inc(IJ2);inc(II);
         with wArShpr[JJ] do begin NRow:=1;NTab:=II_Tabl+3; Itm1:=II; StrN:=2245;mEd:=true;NPos:=2;Lev:=1;end;P1;ArP1[IJ1]:=@wArShpr[JJ];inc(IJ1);inc(II);
    
         with wArRadZaz_w[JJ] do begin NRow:=1;NTab:=II_Tabl+1; Itm3:=II; StrN:=2323;mEd:=true;NPos:=2;Lev:=1;end;P3;ArP3[IJ3]:=@wArRadZaz_w[JJ];inc(IJ3);inc(II);
         with wArStr_os_w[JJ] do begin NRow:=1;NTab:=II_Tabl+1; Itm1:=II; StrN:=2324;mEd:=true;NPos:=2;Lev:=1;end;P1;ArP1[IJ1]:=@wArStr_os_w[JJ];inc(IJ1);inc(II);
         with wArPrizn_radop_w[JJ] do begin NRow:=1;NTab:=II_Tabl+1; Itm4:=II;NTypChs:=0;StrN:=2325;mEd:=true;Lev:=1;end;P4;ArP4[IJ4]:=@wArPrizn_radop_w[JJ];inc(IJ4);inc(II);
    
         with wArAxStr[JJ].awAxialStr do begin NRow:=1;NTab:=II_Tabl+5; Itm5:=II; StrN:=2243;mEd:=true;Lev:=1;end;P5;ArP5[IJ5]:=@wArAxStr[JJ].awAxialStr;inc(IJ5);inc(II);
         with wArYokeRast_bot_w[JJ] do begin NRow:=1;NTab:=II_Tabl+2; Itm1:=II; StrN:=2265;mEd:=true;NPos:=2;Lev:=1;end;P1;ArP1[IJ1]:=@wArYokeRast_bot_w[JJ];inc(IJ1);inc(II);
         with wArElectrH_w[JJ] do begin NRow:=1;NTab:=II_Tabl+2; Itm1:=II; StrN:=2266;mEd:=true;NPos:=2;Lev:=1;end;P1;ArP1[IJ1]:=@wArElectrH_w[JJ];inc(IJ1);inc(II);
         with wArElectr_centre[JJ] do begin NRow:=1;NTab:=II_Tabl+2; Itm1:=II; StrN:=2395;mEd:=false;NPos:=1;Lev:=1;end;P1;ArP1[IJ1]:=@wArElectr_centre[JJ];inc(IJ1);inc(II);
         with wArKanBottom[JJ] do begin NRow:=1;NTab:=II_Tabl+2; Itm3:=II; StrN:=2341;mEd:=true;NPos:=2;Lev:=1;end;P3;ArP3[IJ3]:=@wArKanBottom[JJ];inc(IJ3);inc(II);
         with wArKanTop[JJ] do begin NRow:=1;NTab:=II_Tabl+2; Itm3:=II; StrN:=2342;mEd:=true;NPos:=2;Lev:=1;end;P3;ArP3[IJ3]:=@wArKanTop[JJ];inc(IJ3);inc(II);
    
         with wArComIsZone[JJ] do begin NRow:=1;NTab:=II_Tabl+6; Itm1:=II; StrN:=2339;mEd:=true;NPos:=2;Lev:=1;end;P1;ArP1[IJ1]:=@wArComIsZone[JJ];inc(IJ1);inc(II);
         with wArMprIsZone[JJ] do begin NRow:=1;NTab:=II_Tabl+6; Itm1:=II; StrN:=2340;mEd:=true;NPos:=2;Lev:=1;end;P1;ArP1[IJ1]:=@wArMprIsZone[JJ];inc(IJ1);inc(II);
         with wArKus_pr[JJ] do begin NRow:=1;NTab:=II_Tabl+7; Itm1:=II; StrN:=2249;mEd:=true;NPos:=3;Lev:=1;end;P1;ArP1[IJ1]:=@wArKus_pr[JJ];inc(IJ1);inc(II);
         with wArKus_bm_is[JJ] do begin NRow:=1;NTab:=II_Tabl+7; Itm1:=II; StrN:=2250;mEd:=true;NPos:=3;Lev:=1;end;P1;ArP1[IJ1]:=@wArKus_bm_is[JJ];inc(IJ1);inc(II);
         with wArKus_ob_is[JJ] do begin NRow:=1;NTab:=II_Tabl+7; Itm1:=II; StrN:=2251;mEd:=true;NPos:=3;Lev:=1;end;P1;ArP1[IJ1]:=@wArKus_ob_is[JJ];inc(IJ1);inc(II);
         with wArKus_mpr_is[JJ] do begin NRow:=1;NTab:=II_Tabl+7; Itm1:=II; StrN:=2252;mEd:=true;NPos:=3;Lev:=1;end;P1;ArP1[IJ1]:=@wArKus_mpr_is[JJ];inc(IJ1);inc(II);
     //    with wArKus_msl_is[JJ] do begin NRow:=1;NTab:=II_Tabl+7; Itm1:=II; StrN:=2253;mEd:=true;NPos:=3;Lev:=1;end;P1;ArP1[IJ1]:=@wArKus_msl_is[JJ];inc(IJ1);inc(II);
         with wArTypIsol[JJ] do begin NRow:=1;NTab:=II_Tabl+6; Itm6:=II;NTypChs1:=2;StrN:=2254;mEd:=true;Lev:=1;end;P6;ArP6[IJ6]:=@wArTypIsol[JJ];inc(IJ6);inc(II);
    
         with wArEndIsol_bot[JJ] do begin NRow:=1;NTab:=II_Tabl+6; Itm3:=II; StrN:=2258;mEd:=true;NPos:=1;Lev:=1;end;P3;ArP3[IJ3]:=@wArEndIsol_bot[JJ];inc(IJ3);inc(II);
         with wArEndIsol_top[JJ] do begin NRow:=1;NTab:=II_Tabl+6; Itm3:=II; StrN:=2259;mEd:=true;NPos:=1;Lev:=1;end;P3;ArP3[IJ3]:=@wArEndIsol_top[JJ];inc(IJ3);inc(II);
         with wArTypMat_end_top_w[JJ] do begin NRow:=1;NTab:=II_Tabl+6; Itm6:=II;NTypChs1:=3;StrN:=2326;mEd:=true;Lev:=1;end;P6;ArP6[IJ6]:=@wArTypMat_end_top_w[JJ];inc(IJ6);inc(II);
         with wArTypMat_end_bot_w[JJ] do begin NRow:=1;NTab:=II_Tabl+6; Itm6:=II;NTypChs1:=3;StrN:=2327;mEd:=true;Lev:=1;end;P6;ArP6[IJ6]:=@wArTypMat_end_bot_w[JJ];inc(IJ6);inc(II);
         with wArNst_top_isol[JJ] do begin NRow:=1;NTab:=II_Tabl+6; Itm3:=II; StrN:=2332;mEd:=true;NPos:=0;Lev:=1;end;P3;ArP3[IJ3]:=@wArNst_top_isol[JJ];inc(IJ3);inc(II);
         with wArNst_bot_isol[JJ] do begin NRow:=1;NTab:=II_Tabl+6; Itm3:=II; StrN:=2333;mEd:=true;NPos:=0;Lev:=1;end;P3;ArP3[IJ3]:=@wArNst_bot_isol[JJ];inc(IJ3);inc(II);
         with wArSh_top_isol[JJ] do begin NRow:=1;NTab:=II_Tabl+6; Itm3:=II; StrN:=2334;mEd:=true;NPos:=2;Lev:=1;end;P3;ArP3[IJ3]:=@wArSh_top_isol[JJ];inc(IJ3);inc(II);
         with wArSh_bot_isol[JJ] do begin NRow:=1;NTab:=II_Tabl+6; Itm3:=II; StrN:=2335;mEd:=true;NPos:=2;Lev:=1;end;P3;ArP3[IJ3]:=@wArSh_bot_isol[JJ];inc(IJ3);inc(II);
         with wArRad_top_isol[JJ] do begin NRow:=1;NTab:=II_Tabl+6; Itm3:=II; StrN:=2336;mEd:=true;NPos:=2;Lev:=1;end;P3;ArP3[IJ3]:=@wArRad_top_isol[JJ];inc(IJ3);inc(II);
         with wArRad_bot_isol[JJ] do begin NRow:=1;NTab:=II_Tabl+6; Itm3:=II; StrN:=2337;mEd:=true;NPos:=2;Lev:=1;end;P3;ArP3[IJ3]:=@wArRad_bot_isol[JJ];inc(IJ3);inc(II);
    
     //    with wArPriznZakr[JJ] do begin NRow:=1;NTab:=II_Tabl+6; Itm3:=II; StrN:=2338;mEd:=true;NPos:=0;Lev:=1;end;P3;ArP3[IJ3]:=@wArPriznZakr[JJ];inc(IJ3);inc(II);
         //....
        end;

    Просто говно. Кусок одного из вложенных циклов

    guest, 20 Декабря 2008

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

    +49.5

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    if (gettype($x/2) == 'int') { 
       $rowspan = $x - $i;                     
    } else { 
       $rowspan = ($x - $i) + 1; 
    }

    Проверка на остаток от деления на 2 одним начинающим знакомым ПХП программистом

    guest, 20 Декабря 2008

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

    +25

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    elseif( $manufacturer_id) {
    		$db->query( "SELECT manufacturer_id, mf_name FROM #__{vm}_manufacturer WHERE manufacturer_id='$manufacturer_id'");
    		$db->next_record();
    		$mainframe->setPageTitle( $db->f("mf_name") );
    		echo "Izdeliya ot";
    	}

    guest, 20 Декабря 2008

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