diff --git a/controllers/c_hello.php b/controllers/c_hello.php index b46a781..de6f685 100644 --- a/controllers/c_hello.php +++ b/controllers/c_hello.php @@ -1,12 +1,11 @@ fetch()) $alert = choixAlert("login"); + $req->closeCursor(); } catch (Exception $e) { $alert = choixAlert("query"); } diff --git a/models/m_register.php b/models/m_register.php new file mode 100644 index 0000000..421e4db --- /dev/null +++ b/models/m_register.php @@ -0,0 +1,24 @@ +prepare("SELECT * FROM Utilisateur WHERE nom = ?"); + $req->execute(array($username)); + + if ($req->fetch()) + $alert = choixAlert("register"); + else { + $req->closeCursor(); + $req = $bdd->prepare("INSERT INTO Utilisateur (nom, nbRepet, mot) values (?, ?, ?)"); + $req->execute(array($username, $nb, $word)); + } + $req->closeCursor(); + } catch (Exception $e) { + $alert = choixAlert("query"); + } +} elseif ($bdd instanceof Exception) + $alert = choixAlert("connexion"); diff --git a/views/v_menu.php b/views/v_menu.php index bd51f8a..e530bbc 100644 --- a/views/v_menu.php +++ b/views/v_menu.php @@ -22,8 +22,13 @@ = MENU_ACCUEIL ?> + +