reg match
This commit is contained in:
parent
0796d64cd3
commit
e542cc6035
2 changed files with 4 additions and 1 deletions
2
bdd.php
2
bdd.php
|
@ -418,6 +418,8 @@ function inscription_utilisateur($username,$password_hash,$nom_insa){
|
|||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$stmt = $conn->prepare("INSERT INTO users (username, password_hash,nom_insa) VALUES (?, ?,?)");
|
||||
$stmt->bind_param("sss", $username, $password_hash,$nom_insa);
|
||||
|
||||
|
|
|
@ -8,7 +8,8 @@ function assainir_et_valider_mel($og_mel): string {
|
|||
$mel = filter_var($mel, FILTER_SANITIZE_EMAIL);
|
||||
|
||||
// Vérifie si l'adresse e-mail est valide
|
||||
if (filter_var($mel, FILTER_VALIDATE_EMAIL)) {
|
||||
$reg_pattern = "/^[a-zA-Z0-9._%+-]+@insa-toulouse\.fr$/";
|
||||
if (filter_var($mel, FILTER_VALIDATE_EMAIL) && preg_match($mel,$reg_pattern)) {
|
||||
return $mel; // Si valide, renvoie l'adresse e-mail assainie
|
||||
} else {
|
||||
return "[ERREUR_MEL_MALSAINT]"; // Sinon, renvoie un message d'erreur
|
||||
|
|
Loading…
Reference in a new issue