alpha_full/admin/adminInclude/debugPost.php
2026-04-06 22:58:51 +02:00

63 lines
2.3 KiB
PHP
Executable File

<?php
if ($_SESSION['ENVIRONNEMENT']=='local') {
$localDebug=0;
if (file_exists("./admin/adminInclude/_fonctions/fonctionDebug.php")) include_once("./admin/adminInclude/_fonctions/fonctionDebug.php");
if (file_exists("./adminInclude/_fonctions/fonctionDebug.php")) include_once("./adminInclude/_fonctions/fonctionDebug.php");
if ($localDebug==1) {if (isset($_POST['debugCode']) && $_POST['debugCode'] ) echo '$_POST[debugCode] = '.$_POST['debugCode'];}
if ($localDebug==1) {
echo '$_SESSION[chaineDebug] init = ' .$_SESSION['chaineDebug'];
}
if (isset($_SESSION['chaineDebug'])) {
$chaineDebug=$_SESSION['chaineDebug'];
$debug = str_split($chaineDebug); // tableau indexé de 0 à 14
}
else {
// Valeur initiale pour le cas où rien n'est encore sélectionné
// echo "Init de la chaine";
$chaineDebug = str_repeat("0", 17);
$_SESSION['chaineDebug']=$chaineDebug;
}
if (isset($_POST['debugCode']) && $_POST['debugCode'] == 'post') {
// Pas de debug
if (isset($_POST['debug'][0]) && $_POST['debug'][0]==='1') {
$chaineDebug ='';
for ($i = 1; $i <= 16; $i++) {
$debug[$i] = '0';
$chaineDebug .= $debug[$i];
}
$chaineDebug = '1' .$chaineDebug;
}
else {
// On vérifie les cases cochées et on met à jour la chaîne binaire en conséquence
$chaineDebug ='';
for ($i = 0; $i <= 16; $i++) {
$debug[$i] = isset($_POST['debug'][$i]) ? $_POST['debug'][$i]:'0';
$chaineDebug .= isset($_POST['debug'][$i]) && $_POST['debug'][$i] === '1' ? '1' : '0';
}
if ($debug[1] == '1' || $debug[2] == '1' || $debug[3] == '1' || $debug[4] == '1' || $debug[5] == '1' || $debug[6] == '1' ||$debug[7] == '1' || $debug[8] == '1' || $debug[9] == '1' || $debug[10] == '1' || $debug[11] == '1' || $debug[12] == '1' || $debug[13] == '1' || $debug[14] == '1' || $debug[15] == '1' || $debug[16] == '1' ) $debug[0] = '0';
else $debug[0] = '1';
}
}
// else{
// $chaineDebug ="";
// for ($i = 1; $i <= 14; $i++) {
// $debug[$i] = '0';
// $chaineDebug .= $debug[$i];
// }
// $chaineDebug = '1' . $chaineDebug;
// }
$_SESSION['chaineDebug']=$chaineDebug;
if ($localDebug==1) {
echo ' | $_SESSION[chaineDebug] fin= '.$_SESSION['chaineDebug'];
echo ' | debug [2] = '.$debug['2'].'<br>';
print_r ($debug);
echo '<br>';
}
}
?>