echo "->erreur";
    }
}
//Valide que le formulaire
$verif = formValid();
$verifSession = sessionValid();
if ($verifSession == 1) {
    if ($verif == 1) {
        $verifId = verifId();
        if ($verifId == 0) {
            echo "->id n'existe pas";
            header("location: ../profil?erreur=Erreur mdp");
        } else {
            if ($verifId == 1) {
                echo "->mdp ne corresponde pas";
                header("location: ../profil?erreur=mdp non identique");
            } else {
                if ($verif == 1) {
                    updateIdResetPwd();
                    header("location: ../profil?ok=success");
                }
            }
        }
    } else {
        echo '<br>wrong form';
        header("location: ../profil?erreur=Erreur formulaire");
    }
} else {
    echo '<br>aucune session';
    header("location: ../?erreur=Erreur session");
}
      </body>
     </html>
     ';
    $headers = "From: mooc@isen.fr\n";
    // This is the email address the generated message will be from. We recommend using something like noreply@yourdomain.com.
    $headers = 'MIME-Version: 1.0' . "\r\n";
    $headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
    $headers .= "Reply-To: {$email_address}";
    //$email_body->isHTML(true);
    try {
        mail($to, $email_subject, $email_body, $headers);
    } catch (Exception $Excep) {
        echo $e->errorMessage();
        echo "->erreur mail";
    }
    return true;
}
$verifMail = emailExist();
$verif = formValid();
if ($verifMail == 0) {
    echo '<br>Mail inconnu';
} else {
    if ($verif == 1) {
        $urlResetPwd = updateIdResetPwd();
        echo "<br>Url a envoyer = reset_password?id=" . $urlResetPwd;
        sendEmail($urlResetPwd);
        // envoie de l'email
    } else {
        echo '<br>wrong form';
    }
}