in_array(mixed $needle, array $haystack, bool $strict = false): bool
strripos(string $haystack, string $needle, int $offset = 0): int|false
array_reduce(array $array, callable $callback, mixed $initial = null): mixed
array_map(?callable $callback, array $array, array ...$arrays): array
error_reporting(E_ALL);
, и во-вторых, программист не должен сам себе стрелять в ногу, насильно подавляя сообщения об ошибках. И никогда не использовать оператор подавления ошибок, @.ini_set('display_errors', 1);
. На боевом сервере, соответственно, этот режим должен быть выключен, а логирование наоборот - включено.xdebug.extended_info
в 1
, в конфигах он теперь прописан явно равный 0
<form action="/index.php" method="POST" >
<input name='pers_delete' type='hidden' value="сюда подставляете значение переменной"/>
<input name='submit' type='submit' value="1" class='del_pers'/>
</form>
<?php
if (isset($_POST['submit']))
{
echo $_POST['pers_delete'];
}
?>
<html>
<head>
<meta charset="utf-8">
<title>Визуализатор</title>
<style>
#canvas{
position: absolute;
top: 50px;
left: 0px;
background: #333;
}
#progress{
position: absolute;
top: 50px;
left: 0px;
background: rgba(255, 155, 0, 0.5);
width: 0px;
height: 256px;
}
</style>
</head>
<body bgcolor=#444>
<audio id=audio src="sound.mp3" controls></audio>
<canvas id=canvas width=512 height=256></canvas>
<div id=progress></div>
<script>
var audio = document.getElementById("audio");
var ctx = canvas.getContext("2d");
var color_L = "#7cf", color_R = "#f7c"; // Цвета осциллограмм левого и правого стереоканалов
var audioCtx = new (window.AudioContext || window.webkitAudioContext)();
audio.onplay = function(){b = setInterval(function(){progress.style.width = Math.floor(audio.currentTime / audio.duration * canvas.width) + "px"}, 100)};
audio.onended = function(){
this.currentTime = 0;
clearInterval(b);
progress.style.width = "0px";
}
var source = audioCtx.createBufferSource();
var request = new XMLHttpRequest();
request.open('GET', audio.src, true);
request.responseType = 'arraybuffer';
request.onload = function(){
var audioData = request.response;
audioCtx.decodeAudioData(audioData, function(buffer){
source.buffer = buffer;
data_L = buffer.getChannelData(0);
data_R = buffer.getChannelData(1); // Если аудиофайл моно - поменяйте в этой сроке единицу на ноль.
// При несоответствии количества стереоканалов - ошибка в консоли и код не работает.
for(var i = 0; i < data_L.length; i++){
var x = Math.floor(i / data_L.length * canvas.width);
var L = data_L[i] * canvas.height / 4;
var R = data_R[i] * canvas.height / 4;
if(Math.floor(i / 16) == i / 16){ // Число 16 для больших аудиофайлов лучше побольше. Нужно подбирать.
ctx.fillStyle = color_L;
ctx.fillRect(x, canvas.height * 0.25 + L, 1, -L);
ctx.fillStyle = color_R;
ctx.fillRect(x, canvas.height * 0.75 + R, 1, -R);
}
}
},
function(e){"Error with decoding audio data" + e.err});
}
request.send();
canvas.onmousedown = progress.onmousedown = function(e){
progress.style.width = e.pageX + "px";
audio.currentTime = e.pageX / canvas.width * audio.duration;
}
canvas.ondblclick = function(){audio.play()};
ctx.fillStyle = color_L;
ctx.fillRect(0, canvas.height * 0.25, canvas.width, 1);
ctx.fillStyle = color_R;
ctx.fillRect(0, canvas.height * 0.75, canvas.width, 1);
</script>
</body>
</html>
/usr/bin/flock -w 600 /var/tmp/myscript.lock /root/myscript.sh
Эта комманда запустит /root/myscript.sh и создаст lock-файл для данного процесса. Пока он активен, новый вызов данного скрипта не произойдет.
После завершения программы, блокировка файла снимается и процесс может быть снова запущен.
Параметр -w 600 определяет время ожидания комманды flock на освобождение lock-файла.
Для моментальной отмены выполнения процесса используйте параметр -w 0, для ожидания же бесконечно долгого времени параметр нужно опустить.
https://yoomoney.ru/quickpay/confirm.xml
на свой собственный php обработчик. В этом php обработчике вытаскивай данные из массива $_POST и далее сохраняй их куда надо, а дальше отфутболивай пользователя дальше на оплату обычным редиректом на адрес https://yoomoney.ru/quickpay/confirm.xml
и с кодом 307. Важно (!) надо именно этим кодом, чтобы тело и метод запроса при редиректе не менялись. /var/log/httpd/error_log.
/etc/php.d/20-xmlwriter.ini
Enable xmlwriter extension module
extension=xmlwriter.so