function initMDP($email, $mdp, $mdp2, $bdd) { /* On teste si l'email est dans la base */ $cpt = testMail($bdd, $email); /* Si l'email n'est pas dans la base ou si les mots de passes sont différents, on affiche un message d'erreur */ if ($cpt = 0 or empty($mdp) or $mdp != $mdp2 or !preg_match('#^[\\w.-]+@[\\w.-]+\\.[a-z]{2,6}$#i', $email)) { header("Location: http://localhost/lion/lion/php/perteMdpNew.php"); } else { /* On récupère l'ID du membre pour mettre à jour en toute sécurité */ $id = getMemberIDMail($bdd, $email); /* Réinitialisation du mot de passe */ setMdp($bdd, $id, $mdp); /* Redirection vers la page d'inscription */ header("Location: http://localhost/lion/lion/php/inscription.php"); } }
function fullCheck($array) { global $varNames, $errmsg; $errmsg = ""; foreach ($varNames as $name) { if (!isset($array[$name])) { $errmsg = $errmsg . "Erreur, champ " . $name . " manquant.</br>\n"; } } if ($errmsg != "") { return $errmsg; } testMotDePasse($array["mdp"]); testNom($array["nom"]); testPrenom($array["prenom"]); testMail($array["mail"]); testSexe($array["sexe"]); testNaissance($array["naissance"]); testAdresse($array["adresse"]); testCodePostal($array["codepostal"]); testVille($array["ville"]); return $errmsg; }