63 lines
2.9 KiB
PHP
Executable File
63 lines
2.9 KiB
PHP
Executable File
<?php
|
|
function monDebug($debugNiveau, array $champsListe, $fileName='', $nomFicAppelant='') {
|
|
global $debugMsg;
|
|
global $nomFicAppelant;
|
|
|
|
$couleur='black';
|
|
// 🟣 🟪 🔴
|
|
$ico= '💠 ';
|
|
if($debugNiveau==1) {$ico= '🟣 '; $couleur='black';} // bleu clair
|
|
if($debugNiveau==2) {$ico= '🔷 '; $couleur='black';} // Orange marron
|
|
if($debugNiveau==5) {$ico= '🟢 '; $couleur='black';} // Marron sépia
|
|
if($debugNiveau==6) {$ico= '♦️ '; $couleur='black';} // Bleu royal
|
|
|
|
if (isset($fileName) && !empty($fileName)) {
|
|
if( strpos ( strtolower( $fileName ) , "update" )!=false) { $couleur='#4169E1'; $ico='🔶 ';} // Bleu royal
|
|
if (isset($nomFicAppelant) && !empty($nomFicAppelant)) {
|
|
$debugMsg .= '<br><span style="word-break: break-word; color: ' .$couleur.'">' .$ico.' ' .$fileName. ' ( ' .$nomFicAppelant. ' ) => </span>';}
|
|
else
|
|
$debugMsg .= '<br><span style="color: ' .$couleur.' word-break: break-word;">' .$ico.' ' .$fileName. ' -></span>';
|
|
}
|
|
|
|
if ($debugNiveau==1 || $debugNiveau==2 || $debugNiveau==5 || $debugNiveau==6 || $debugNiveau==7) {
|
|
$debugMsg .= '<span style="word-break: break-word;" >';
|
|
foreach ($champsListe as $nom => $valeur) {
|
|
$debugMsg .= $nom. ' = ';
|
|
if (isset($valeur) && !is_array($valeur) ) { $debugMsg .= $valeur;}
|
|
|
|
else { $debugMsg .= json_encode ($valeur) ; }
|
|
$debugMsg .= ' | ';
|
|
}
|
|
$debugMsg .= '</span>';
|
|
}
|
|
|
|
if ($debugNiveau==3) {
|
|
$debugMsg .= '<br><b>POST ==></b>';
|
|
$debug_post = print_r(($_POST));
|
|
$debugMsg .= '<span style="style="word-break: break-word; color: ' .$couleur.'"> 📤<pre>' . ($debug_post) . '</pre></span>';
|
|
|
|
$debugMsg .= '<br><span style="word-break: break-word;"">HTTP_REFERER = '; if (isset($_SERVER['HTTP_REFERER'] ) ) $debugMsg .= $_SERVER['HTTP_REFERER'].'</span>' ;
|
|
$debugMsg .= '<br><span style="word-break: break-word;"">REQUEST_URI = '; if (isset($_SERVER['REQUEST_URI'] ) ) $debugMsg .= $_SERVER['REQUEST_URI'].'</span>' ;
|
|
}
|
|
|
|
if ($debugNiveau==4 && $champsListe =='') {
|
|
$debugMsg .= '<br><b>GET ==></b>';
|
|
$debug_get = print_r(($_GET));
|
|
$debugMsg .= '<span style="style="white-space: normal; overflow-wrap: break-word; word-break: break-word; color: ' .$couleur.'"> 📥<pre>' . ($debug_get) . '</pre></span>';
|
|
}
|
|
|
|
if ($debugNiveau==4 && $champsListe!='') {
|
|
foreach ($champsListe as $nom => $valeur) {
|
|
$debugMsg .= '<br><b>' .$nom. ' ==></b>';
|
|
$debug_tab = print_r($valeur);
|
|
$debugMsg .= '<span style="style="white-space: normal; overflow-wrap: break-word; word-break: break-word; color: ' .$couleur.'"> 📥<pre>' . ($debug_tab) . '</pre></span>';
|
|
}
|
|
}
|
|
|
|
if ($debugNiveau==8) {
|
|
$debugMsg .= '<br><b>SESSION ==></b>';
|
|
$debug_session = print_r(($_SESSION));
|
|
$debugMsg .= '<span style="white-space: normal; overflow-wrap: break-word; word-break: break-word; color: ' .$couleur.'">🗝️<pre>' . ($debug_session) . '</pre></span>';
|
|
}
|
|
}
|
|
?>
|