function bs_tg($tgam) {
$ch = curl_init();
$opt = array(
CURLOPT_URL => 'https://api.telegram.org/bot' . TELEGRAM_TOKEN . '/sendMessage',
CURLOPT_POST => TRUE,
CURLOPT_RETURNTRANSFER => TRUE,
CURLOPT_TIMEOUT => 10,
CURLOPT_POSTFIELDS => array(
'chat_id' => TELEGRAM_CHATID,
'text' => $tgam,
);
curl_setopt_array($ch, $opt);
curl_exec($ch);
curl_close($ch);
}
$tempbody = is_array($massiv) ? implode(',' , $massiv) : $massiv ;
bs_tg($tempbody);
function dateToText($date) {
$monthOfYear = date("F Y", strtotime($date));
$daysInMonth = date("d", strtotime("last day of {$monthOfYear}"));
$dayOfMonth = date("d", strtotime($date));
$dayOfWeek = date("N", strtotime($date));
$occurance = 0;
$maxOccurance = 0;
foreach (range(1, $daysInMonth) as $day) {
if (date("N", strtotime("{$day} {$monthOfYear}")) == $dayOfWeek) {
$maxOccurance++;
if ($day <= $dayOfMonth) {
$occurance++;
}
}
}
$weekdayNumber = $occurance == $maxOccurance
? "last"
: match($occurance) {
1 => "first",
2 => "second",
3 => "third",
4 => "fourth"
}
;
$text = $weekdayNumber . " " . date("l \\o\\f F", strtotime($date));
return strtolower($text);
}
-- если задавать год вручную
-- SET @thisYear = '2019';
-- SET @thisYearDecemberBegin = CONCAT(@thisYear, '-12-01');
-- декабрь этого года
SET @thisYearDecemberBegin = CONCAT(YEAR(NOW()), '-12-01');
SELECT DATE_ADD(@thisYearDecemberBegin
, INTERVAL
( ( 8 - DAYOFWEEK(@thisYearDecemberBegin) ) % 7 ) + 7
DAY
) AS second_sunday_of_month;
echo date('d.m.y', strtotime('third tuesday of this month'));
как обозначить в базе
'post_type' => 'post',
'posts_per_page' => '1',
's' => '<img',
background:#E2E7EA
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#E2E7EA', endColorstr='#C5D5D6'); /* for IE */
background-image: -webkit-gradient(linear, left top, left bottom, from(#E2E7EA), to(#C5D5D6)); /* for webkit browsers */
background-image: -webkit-linear-gradient(top, #E2E7EA, #C5D5D6);
background-image: -moz-linear-gradient(top, #E2E7EA, #C5D5D6); /* for firefox 3.6+ */
background-image: -ms-linear-gradient(top, #E2E7EA, #C5D5D6);
background-image: -o-linear-gradient(top, #E2E7EA, #C5D5D6);
(function () {
var message = $('#sub_minus_info');
var limit = $('#bb');
var button = $('#sub_minus');
$('#bonus_card').on('change paste keyup', function() {
var current_value = +$(this).val();
var max_allowed = +$(limit).val();
var is_disabled = current_value < 0 || current_value >= max_allowed;
$(button).prop('disabled', is_disabled);
$(message).html(is_disabled ? '<div>не более <b>'+ max_allowed +'</b> баллов</div>' : '');
});
})();
$('#sub_minus').attr('disabled', 'disabled'), $('#sub_minus_info').html('<div>не более <b>'+ b +'</b> баллов</div>')
var b = +$('#bb').val();
var f = +$('#bonus_card').val();
var b = parseInt($('#bb').val(), 10);
var f = parseInt($('#bonus_card').val(), 10);
$('#nub_card').on('change',function(){
if(this.value){
var that= this;
$.ajax({
url:'адрес_сайта/function.php',
data: {
'fk_card': 1,
'n_card': that.value
},
success: function(res) {
if (res == 0 ) {
$('#bonus_card').prop('disabled',true)
}
$('#info_card').val(res);
}
});
}
});
попробуй так $('#nub_card').keypress(function(){
if($('#nub_card').val()!=''){
$.post('адрес_сайта/function.php', {
'fk_card': 1,
'n_card': $('#nub_card').val()
},
function(data){
if(data == 0) {
$('#bonus_card').prop('disabled', 'disabled');
} else {
$('#info_card').html(data); });
}
}
});