diff --git a/manager/security.php b/manager/security.php index 3eea68b..1a9bbb4 100755 --- a/manager/security.php +++ b/manager/security.php @@ -153,7 +153,7 @@ /* [1] Vérification de l'intégrité des tableaux =============================================================================*/ $areArrays = is_array($tabVar) && is_array($tabForm); // si ce sont bien des tabeaux - $areNEmpty = $areArrays && count($tabVar) > 0 && count($tabVar) > 0; // si ils ne sont pas vides + $areNEmpty = $areArrays && count($tabVar) > 0 && count($tabForm) > 0; // si ils ne sont pas vides $haveEqLen = $areNEmpty && count($tabVar) == count($tabForm); // si ils ont la même taille if( !$haveEqLen ) // si toutes les conditions ne sont pas vérifiées @@ -164,10 +164,29 @@ =============================================================================*/ $checker = true; // on définit le checker à VRAI + // Vérification des types + // pour chaque variable - foreach ($tabVar as $type => $value){ + foreach ($tabVar as $type => $tabVal){ + foreach($tabVal as $variable) { // <--- Gestion des tableaux de valeurs ??? + $checker = ($type == gettype($variable)); + if($checker == false) + return (" variable : ".(String)$variable." non conforme, type attendu : ".(String)$type." type reçu :".gettype($variable)); + } } + // Vérification des formats + + foreach($tabForm as $format => $tabVal) { + foreach ($tabVal as $variable) { // <--- Gestion des tableaux de valeurs ??? + $checker = preg_match($format,$variable); + if($checker == false) + return (" variable : ".$variable." non conforme, format attendu : ".(String)$format." format reçu :".(String)$variable); + } + } + + return $checker; + } ?> \ No newline at end of file