1. Pascal / Говнокод #23106

    −1

    1. 1
    2. 2
    (багрепорт)
    http://www.alphaskins.com/forum/index.php?app=core&module=attach&section=attach&attach_rel_module=post&attach_id=8330Сергох Гончаров с AlphaSkins.com шалит )

    Сергох Гончаров с AlphaSkins.com шалит )

    antipattern, 06 Июня 2017

    Комментарии (0)
  2. Java / Говнокод #23105

    −1

    1. 1
    2. 2
    3. 3
    DBHelper dbHelper = DBConnect.getIntance().getDBHelper();
    DBConnect.getIntance().addCycleReport(reportObj,dbHelper);
    dbHelper.close();

    Коллега попросил помочь с дебагом

    diver92, 06 Июня 2017

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

    0

    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
    private function  auth($data){
            #Проверка данных и авторизация
            $login = str_replace(" ", "", mysql_real_escape_string(htmlspecialchars(strip_tags(trim($data['login'], ' /')))));
            $pwd = str_replace(" ", "", mysql_real_escape_string(htmlspecialchars(strip_tags(trim($data['password'], ' /')))));
    
            $user = Model_Auth::getUser($login);
            if($user===false){
                return false;
            }else{
                if($user['password']==md5(md5($pwd))){
                    $checksumm = md5($user['login'].$user['password'].$user['rules']);
                    Model_Auth::updateUser($user['id'],$checksumm);
                    Model_Auth::updateUserStatus($user['id']);
                    setcookie("user", $checksumm, time()+3600, '/', $_SERVER['HTTP_HOST']);
                    if (isset($_SESSION['ref_url'])) {
                        $ref_url = $_SESSION['ref_url'];
                        unset($_SESSION['ref_url']);
                        header('Location:'.$ref_url);
                    } else {
                        header('Location:'.$GLOBALS['main_page']);
                    }
                }else{
                    return false;
                }
            }
        }

    А теперь удивитесь - если зайти на сайт и у вас внезапно в куках браузера завалялась пустая переменная user, то вы будете автоматически авторизованы от имени того пользователя, который еще ни разу не заходил в систему потому-что $user не проверяется на пустоту

    McLotos, 06 Июня 2017

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

    +4

    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
    function check_for_injection($_arr_check) {
        $inj = 0;
        foreach ($_arr_check as $n=>$v) {
            $_text = "SELECT ";
            if (strpos(strtoupper($v), $_text)!==false) $inj = 1;
            $_text = " SELECT";
            if (strpos(strtoupper($v), $_text)!==false) $inj = 1;
            $_text = "DELETE ";
            if (strpos(strtoupper($v), $_text)!==false) $inj = 1;
            $_text = "UPDATE ";
            if (strpos(strtoupper($v), $_text)!==false) $inj = 1;
            $_text = "INSERT ";
            if (strpos(strtoupper($v), $_text)!==false) $inj = 1;
            $_text = "LOAD ";
            if (strpos(strtoupper($v), $_text)!==false) $inj = 1;
            $_text = "DROP ";
            if (strpos(strtoupper($v), $_text)!==false) $inj = 1;
            $_text = "INTO ";
            if (strpos(strtoupper($v), $_text)!==false) $inj = 1;
            $_text = "OUTFILE ";
            if (strpos(strtoupper($v), $_text)!==false) $inj = 1;
            $_text = "CALL ";
            if (strpos(strtoupper($v), $_text)!==false) $inj = 1;
        }
        return $inj;
    }
    $dd = check_for_injection($_REQUEST);
    if ($dd==1) die();

    Надежный способ проверки на взлом

    ostin, 05 Июня 2017

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

    −1

    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
    $(document).ready(function() {
    	
    	$('.tab').click(function(){
    
    	    var tabs = $(this).closest('.tabs');
    
    	    // Удаляем классы active
    	    $(this).siblings().removeClass('active');
    	    tabs.children('.tabs-content').children('.tabs-content-item').removeClass('active');
    
    	    // Добавляем классы active
    	    $(this).addClass('active');
    	    tabs.children('.tabs-content').children('.tabs-content-item').eq($(this).index()).addClass('active');
    	})
    	
    });

    Вот пример:
    https://codepen.io/ShvedOFF/pen/weBgrQ

    Как более грамотно оформить данный код?
    Все отлично работает, но выглядит коряво.

    Shved, 05 Июня 2017

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

    0

    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
    function IsExecutablePacked(FileName: WideString): Boolean;
    var
    i: Cardinal;
    CompressionRatio: Double;
    Count: Cardinal;
    MathX: array [0 .. 255] of Integer;
    FileStream: TFileStream;
    Buffer: PAnsiChar;
    FileHandle: THandle;
    begin
    Result := False;
    try
    FileHandle := 0;
    FileHandle := CreateFileW(PWideChar(FileName), GENERIC_READ, FILE_SHARE_READ or FILE_SHARE_DELETE, nil, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
    if (FileHandle <> 0) and FileExists(FileName) then
    begin
    try
    FileStream := TFileStream.Create(FileHandle);
    Count := FileStream.Seek(0, soFromEnd);
    try
    GetMem(Buffer, Count);
    FileStream.Seek(0, soFromBeginning);
    FileStream.Read(Buffer^, Count);
    CompressionRatio := 0;
    FillChar(MathX, Sizeof(MathX), 0);
    for i := 0 to Count - 1 do
    Inc(MathX[Windows.PByte(DWORD(Buffer) + (i))^]);
    for i := 0 to 255 do
    if MathX > 0 then
    CompressionRatio := CompressionRatio - Log2(MathX / Count) * MathX;
    finally
    FreeMem(Buffer, Count);
    end;
    CompressionRatio := (Count * 8) / CompressionRatio;
    CompressionRatio := 100 / CompressionRatio;
    if CompressionRatio > 97 then
    Result := True;
    finally
    FileStream.Free;
    end;
    end;
    finally
    end;
    end;

    "Ис Эксекутабле Пуцкед" - форматирование сохранено.

    antipattern, 04 Июня 2017

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

    0

    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
    /* Стили для вспалывающих окон */
    	#back_call,#back_call1,#letter_us,#letter_us_2{display:none;position:fixed;top:0;bottom:0;left:0;right:0;width:100%;height:100%;background:url('../images/pop_up_bg.jpg') center center no-repeat;background-size:cover;overflow:auto;z-index:11500}
    		#bcc_table,#bcc_table1, #bcc_table-cell,#bcc_table-cell, #lu_table, #lu_table-cell,#lu_table_2, #lu_table-cell_2{width:100%;min-height:100%}
    		#bcc_table,#bcc_table1,#lu_table,#lu_table_2{display:table}
    			#bcc_table-cell,#bcc_table-cell1,#lu_table-cell,#lu_table-cell_2{display:table-cell;vertical-align:middle;text-align:center}
    				#bcc_registration-form,#bcc_registration-form1,#lu_registration-form,#lu_registration-form_2{display:inline-block;width:1000px;min-height:637px;padding:30px}
    				#bcc_registration-form>div,#bcc_registration-form1>div,#lu_registration-form>div,#lu_registration-form_2>div{position:relative}
    .bcc_wrapper h1,.lu_wrapper h1,.lu_wrapper h1{color:#84c8eb;margin-bottom:45px;font-family:'Yeseva One';text-transform:uppercase;font-size:31px;line-height:32px;letter-spacing:2px;margin-top:9px;text-align:center;margin-right:93px}
    				.bcc_wrapper .bc_close_link,.lu_wrapper .lu_close_link,.lu_wrapper .lu_close_link{display:inline-block;position:absolute;top:5px;right:0;width:40px;height:40px;text-indent:-9999px;background:url('../images/close_link_bg.jpg') center center no-repeat}
    					.bcc_wrapper .bc_close_link:hover,.lu_wrapper .lu_close_link:hover,.lu_wrapper .lu_close_link:hover{box-shadow:0 0 50px rgba(132, 200, 235,0.3), 0 0 50px rgba(132, 200, 235,0.3), 0 0 50px rgba(132, 200, 235,0.3)}
    					.div_bc_form_wrapper,.div_lu_form_wrapper,.div_lu_form_wrapper{margin-right:152px}
    						#mcf7_inp_wrapp_cb .wpcf7-response-output,#mcf7_inp_wrapp_lu .wpcf7-response-output,#mcf7_inp_wrapp_lu_2 .wpcf7-response-output{color:#fff;text-align:center;font-family:'gotham_light';font-size:15px;line-height:31px;word-spacing:1px;margin-bottom:15px}
    							.bcc_wrapper #mcf7_inp_wrapp_cb p,.lu_wrapper #mcf7_inp_wrapp_lu p,.lu_wrapper #mcf7_inp_wrapp_lu_2 p{height:51px;margin-bottom:55px;text-align:justify}
    							.bcc_wrapper #mcf7_inp_wrapp_cb p{margin:0}
    								.bcc_wrapper #mcf7_inp_wrapp_cb p span.lu_wrapper #mcf7_inp_wrapp_lu p span,.lu_wrapper #mcf7_inp_wrapp_lu_2 p span{display:inline-block}
    								.bcc_wrapper #mcf7_inp_wrapp_cb p span:nth-child(1),.lu_wrapper #mcf7_inp_wrapp_lu p span:nth-child(1),.lu_wrapper #mcf7_inp_wrapp_lu_2 p span:nth-child(1){float:left;margin-right:15px}
    								.bcc_wrapper #mcf7_inp_wrapp_cb p span:nth-child(2),.lu_wrapper #mcf7_inp_wrapp_lu p span:nth-child(2),.lu_wrapper #mcf7_inp_wrapp_lu_2 p span:nth-child(2){float:left}
    								.bcc_wrapper #mcf7_inp_wrapp_cb p span:nth-child(3),.lu_wrapper #mcf7_inp_wrapp_lu p span:nth-child(3),.lu_wrapper #mcf7_inp_wrapp_lu_2 p span:nth-child(3){float:right}
    								.bcc_wrapper #mcf7_inp_wrapp_cb p span input,.lu_wrapper #mcf7_inp_wrapp_lu p span input,.lu_wrapper #mcf7_inp_wrapp_lu_2 p span input{display:inline-block;box-sizing:border-box;border:1px solid #fff;background-color:transparent;height:50px;border-radius:5px;font-size:18px;line-height:19px;letter-spacing:1px;color:#fff;font-family:'gotham_light';padding:0 19px}
    								.bcc_wrapper #mcf7_inp_wrapp_cb p span input+span,#bcc-form .screen-reader-response,.lu_wrapper #mcf7_inp_wrapp_lu p span input+span,.lu_wrapper #mcf7_inp_wrapp_lu_2 p span input+span,#lu-form .screen-reader-response,#letter_us_2 .screen-reader-response{display:none}
    								.bcc_wrapper #mcf7_inp_wrapp_cb p span:nth-child(1) input,.bcc_wrapper #mcf7_inp_wrapp_cb p span:nth-child(2) input,.lu_wrapper #mcf7_inp_wrapp_lu p span:nth-child(1) input,.lu_wrapper #mcf7_inp_wrapp_lu_2 p span:nth-child(1) input,.lu_wrapper #mcf7_inp_wrapp_lu p span:nth-child(2) input,.lu_wrapper #mcf7_inp_wrapp_lu_2 p span:nth-child(2) input{width:266px}
    								.bcc_wrapper #mcf7_inp_wrapp_cb p span:nth-child(3) input,.lu_wrapper #mcf7_inp_wrapp_lu p span:nth-child(3) input,.lu_wrapper #mcf7_inp_wrapp_lu_2 p span:nth-child(3) input{width:288px}
    								.bcc_wrapper #mcf7_sbm_wrapp,.lu_wrapper #mcf7_sbm_wrapp_lu,.lu_wrapper #mcf7_sbm_wrapp_lu_2{text-align:center}
    									.bcc_wrapper #mcf7_sbm_wrapp img{float:right}
    									.bcc_wrapper #mcf7_sbm_wrapp{margin-top: 83px;}
    									.lu_wrapper #mcf7_sbm_wrapp_lu img,.lu_wrapper #mcf7_sbm_wrapp_lu_2 img{float:right;margin-top:107px}
    									.bcc_wrapper #mcf7_sbm_wrapp input,.lu_wrapper #mcf7_sbm_wrapp_lu input,.lu_wrapper #mcf7_sbm_wrapp_lu_2 input{display:inline-block;background-color:transparent;border:1px solid #fff;width:370px;height:80px;cursor:pointer;text-align:center;margin-top:107px;text-transform:uppercase;font-size:19px;line-height:19px;letter-spacing:5px;color:#fff;font-family:'gotham_light';word-spacing:2px}
    									.bcc_wrapper #mcf7_sbm_wrapp input{margin:0}
    									.bcc_wrapper #mcf7_sbm_wrapp input:hover,.lu_wrapper #mcf7_sbm_wrapp_lu input:hover,.lu_wrapper #mcf7_sbm_wrapp_lu_2 input:hover{text-shadow:0 0 15px rgba(132, 200, 235, 0.7), 0 0 15px rgba(132, 200, 235, 0.7), 0 0 15px rgba(132, 200, 235, 0.7)}
    								#required_fields_1,#required_fields_3,#required_fields_4,#required_fields_5,#required_fields_6,#required_fields_7{color:#fff;font-family:gotham_light;font-size:15px;line-height:31px;word-spacing:1px;text-align:center}
    						#lu_registration-form #mcf7_ta_wrapp_lu span,#lu_registration-form_2 #mcf7_ta_wrapp_lu_2 span{display:block;height:256px;box-sizing:border-box;padding:16px 17px;border:1px solid #fff;border-radius:5px;}
    						#lu_registration-form #mcf7_ta_wrapp_lu span textarea,#lu_registration-form_2 #mcf7_ta_wrapp_lu_2 span textarea{background-color:transparent;width:100%;height:100%;font-size:18px;line-height:19px;letter-spacing:1px;color:#fff;font-family:'gotham_light'}

    Выполняю заказы. На Битрих.

    nazivin, 02 Июня 2017

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

    0

    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
    body{
    	background: gray;
    	text-align: center;
    }
    #serials{
    	text-align: center;
    }
    #search{
    	font-weight: bold;
    	border-radius: 0px 20px 20px 0px;
    }
    #search:hover{
    	color: white;
    }	
    input{
    	border-radius: 20px 0px 0px 20px;
    	text-align: center;
    }
    input, #search{
    	border: grey;
    	background: #9e9e9e !important;
    	font-size: 20px;
    	padding: 10px 20px 10px 10px;
    	outline: none;
    	color: white;
    }

    tiarait, 02 Июня 2017

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

    0

    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
    function try_to_date(p_value in varchar2)
    return date
    is
      l_date date;                  
      
      l_fmt sys.odcivarchar2list := sys.odcivarchar2list('DD.MM.YYYY', 'YYYY/MM/DD', 'YYYY.MM.DD', 'dd.mm.yyyy', 'yyyy/mm/dd', 'yyyy.mm.dd');
    begin
    
      for i in 1..l_fmt.count loop  
        begin
          l_date := to_date(p_value, l_fmt(i));    
          return l_date;
        exception
        when OTHERS then null;    
        end;
      end loop;
      
      return null;  
      
    end;

    n1919, 02 Июня 2017

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

    0

    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
    <div>
        <div class="advantages-box">
        <div class="container">
            <div class="row">
                <h2>Наши преимущества</h2>
                <div class="col-xs-6 col-md-3 col-sm-3 advantage-item">
                    <div class="img-box">
    				<i class="fa fa-truck" aria-hidden="true"></i>
                       </div>
                    <p>Бесплатный выезд специалиста</p>
                </div>
                <div class="col-xs-6 col-md-3 col-sm-3 advantage-item">
                    <div class="img-box">
                         <i class="fa fa-rocket" aria-hidden="true"></i>
                    </div>
                    <p>Современный дизайн</p>
                </div>
                <div class="col-xs-6 col-md-3 col-sm-3 advantage-item">
                    <div class="img-box">
                        <i class="fa fa-rub" aria-hidden="true"></i>
                    </div>
                    <p>Доступная стоимость</p>
                </div>
                <div class="col-xs-6 col-md-3 col-sm-3advantage-item">
                    <div class="img-box">
                        <i class="fa fa-cubes" aria-hidden="true"></i>
                    </div>
                    <p>Услуги по монтажу камня</p>
                </div>
    			<div class="col-xs-6 col-md-4 col-sm-4 advantage-item">
                    <div class="img-box">
                         <i class="fa fa-thumbs-up" aria-hidden="true"></i>
                    </div>
                    <p>Гарантия качества</p>
    				</div>
    			<div class="col-xs-6 col-md-4 col-sm-4 advantage-item">
                    <div class="img-box">
                         <i class="fa fa-area-chart" aria-hidden="true"></i>
                    </div>
                    <p>Гибкая система скидок</p>
    				</div>
    			<div class="col-xs-6 col-md-4 col-sm-4  advantage-item">
                    <div class="img-box">
                         <i class="fa fa-universal-access" aria-hidden="true"></i>
                    </div>
                    <p>Индивидуальное изготовление
    камня по Вашим эскизам         
    </p>
    		
            </div>
        </div>
    </div></div>

    snegoviktlt, 01 Июня 2017

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