- 1
- 2
- 3
DBHelper dbHelper = DBConnect.getIntance().getDBHelper();
DBConnect.getIntance().addCycleReport(reportObj,dbHelper);
dbHelper.close();
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
−1
DBHelper dbHelper = DBConnect.getIntance().getDBHelper();
DBConnect.getIntance().addCycleReport(reportObj,dbHelper);
dbHelper.close();
Коллега попросил помочь с дебагом
0
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 не проверяется на пустоту
+4
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();
Надежный способ проверки на взлом
−1
$(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
Как более грамотно оформить данный код?
Все отлично работает, но выглядит коряво.
0
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;
"Ис Эксекутабле Пуцкед" - форматирование сохранено.
0
/* Стили для вспалывающих окон */
#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'}
Выполняю заказы. На Битрих.
0
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;
}
0
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;
0
<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>
0
<div class="advantages-box">
<div class="container">
<div class="row">
<h2>Наши услуги</h2>
<div class="col-md-3 col-sm-6 col-md-offset-2 advantage-item">
<div class="img-box">
<p><a href="http://sergio-pietra.ru/delivery.html"><img alt="" src="http://sergio-pietra.ru/image/catalog/SERGIO/bistrayadostavka1.png"</p>
<p>Доставка камня</p>
</div>
</div>
<div class="col-md-3 col-sm-6 advantage-item">
<div class="img-box">
<p><a href="http://sergio-pietra.ru/podgotovitelnie-raboty.html"><img alt="" src="http://sergio-pietra.ru/image/catalog/SERGIO/pogotovka.png"</p>
<p>Подготовительные работы</p>
</div>
</div>
<div class="col-md-3 col-sm-6 advantage-item">
<div class="img-box">
<p><a href="http://sergio-pietra.ru/ukladka-dekorativnogo-kamnya.html"><img alt="" src="http://sergio-pietra.ru/image/catalog/SERGIO/usluga.png"</p>
<p>Услуги монтажа</p>
</div>
</div>
</div>
</div>
</div>