$ids = array_unique(array_column($arr, 'user_id'));
$result = array_filter($arr2, fn($n) => !in_array($n['users_id'], $ids));
case
('Промо'):
$sql = 'SELECT * FROM promo';
$result = mysqli_query($link, $sql);
$array = array();
while($row = mysqli_fetch_array($result))
{
$item['promo_name'] = $row['promo_name'];
$item['promo_descr'] = $row['promo_descr'];
$item['promo_link'] = $row['promo_link'];
$cod[] = $item;
}
$text = ''; // <---
foreach($cod as $v)
{
$new_line = $v['promo_name'].' - '.$v['promo_descr'].' <a href="'.$v['promo_link'].'">перейти к акции</a><br/>';
if(mb_strlen($text) + mb_strlen($new_line) > 4096) // <---
{
file_get_contents($GLOBALS['api'].'/sendMessage?chat_id='.$chat_id.'&reply_markup='.$keyboard.'&text='.urlencode($text));
$text = '';
}
$text .= $new_line; // <---
}
if($text != '') // <---
{
file_get_contents($GLOBALS['api'].'/sendMessage?chat_id='.$chat_id.'&reply_markup='.$keyboard.'&text='.urlencode($text));
}
// file_get_contents($GLOBALS['api'] . '/sendMessage?chat_id='.$chat_id.'&reply_markup='.$keyboard.'&text=' . urlencode("Код ".$row['promo_name']." \n ".$row['promo_descr']." \n Ссылка ".$row['promo_link']." "));
break;
RewriteCond %{QUERY_STRING} (?:^|&)wordfence_lh=
RewriteRule ^ /404.php? [R=301,L]
ErrorDocument 404 /404.php
RewriteCond %{QUERY_STRING} (?:^|&)wordfence_lh=
RewriteRule ^ - [R=404,L]
RewriteCond %{QUERY_STRING} (?:^|&)wordfence_lh=
RewriteRule ^ /404.php? [L]
window.addEventListener('resize', function () { // Можно принимать объект события
// Если width глобальная переменная
width = screen.width;
});
$.ajax({
xhr: function() {
var xhr = new window.XMLHttpRequest();
xhr.addEventListener("progress", function(evt) {
if (evt.lengthComputable) {
var percentComplete = evt.loaded / evt.total;
//Do something with download progress
}
}, false);
return xhr;
},
type: 'POST',
url: "/",
data: {},
success: function(data){
//Do something on success
}
});
<Switch>
<Route path="/" component={A} /> // <-- будет отрендерен только этот роут
<Route path="/" component={A} />
</Switch>
<>
<Route path="/" component={A} /> // <-- будет отрендерен этот роут
<Route path="/" component={A} /> // <-- и этот так же будет отрендерен
</>
CREATE TABLE IF NOT EXISTS `roles` (
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`description` varchar(255) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `uniq_name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO `roles` (`id`, `name`, `description`) VALUES(1, 'login', 'Login privileges, granted after account confirmation');
INSERT INTO `roles` (`id`, `name`, `description`) VALUES(2, 'admin', 'Administrative user, has access to everything.');
CREATE TABLE IF NOT EXISTS `roles_users` (
`user_id` int(11) UNSIGNED NOT NULL,
`role_id` int(11) UNSIGNED NOT NULL,
PRIMARY KEY (`user_id`,`role_id`),
KEY `fk_role_id` (`role_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `users` (
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`email` varchar(255) NOT NULL,
`username` varchar(255) NOT NULL DEFAULT '',
`password` varchar(255) NOT NULL,
`logins` int(11) UNSIGNED NOT NULL DEFAULT 0,
`last_login` int(11) UNSIGNED,
PRIMARY KEY (`id`),
UNIQUE KEY `uniq_username` (`username`),
UNIQUE KEY `uniq_email` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `user_tokens` (
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`user_id` int(11) UNSIGNED NOT NULL,
`user_agent` varchar(255) NOT NULL,
`token` varchar(255) NOT NULL,
`created` int(11) UNSIGNED NOT NULL,
`expires` int(11) UNSIGNED NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `uniq_token` (`token`),
KEY `fk_user_id` (`user_id`),
KEY `expires` (`expires`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE `roles_users`
ADD CONSTRAINT `roles_users_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `roles_users_ibfk_2` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE;
ALTER TABLE `user_tokens`
ADD CONSTRAINT `user_tokens_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;