function lireParam($param, $filtre = "", $methode = "", $purifier = 1) { if ($methode == "post") { $tab =& $_POST; } else { if ($methode == "get") { $tab =& $_GET; } else { $tab =& $_REQUEST; } } if (isset($tab[$param])) { $param = $tab[$param]; if (get_magic_quotes_gpc()) { $param = stripslashes($param); } if (preg_match("/^([^\\+]*)\\+(.*)\$/", $filtre, $resfiltre)) { $filtre = $resfiltre[1]; $complement = $resfiltre[2]; } else { $complement = ""; } return filtrevar($param, $filtre, $complement, $purifier); } else { return ''; } }
/** * * @param string $nom * @param string $filtre * @param bool $defaut * @param bool $purifier */ public static function lireVarFond($nom, $filtre = 'int', $defaut = false, $purifier = 1) { $nom = strtolower($nom); if (isset(self::$varFond[$nom])) { if (preg_match("/^([^\\+]*)\\+(.*)\$/", $filtre, $resfiltre)) { $filtre = $resfiltre[1]; $complement = $resfiltre[2]; } else { $complement = ""; } $val = filtrevar(self::$varFond[$nom], $filtre, $complement, $purifier); if ($val !== '') { return $val; } } return $defaut; }