diff --git a/src/app/controllers/HomeController.php b/src/app/controllers/HomeController.php new file mode 100644 index 0000000..5247f8e --- /dev/null +++ b/src/app/controllers/HomeController.php @@ -0,0 +1,18 @@ +prepare('SELECT * FROM account WHERE email = :email'); +$query->execute(['email' => $email]); +$account = $query->fetchObject(Account::class); + +if(!$account) { + header('Location: /sign-in?error=2'); +} else if(!password_verify($password, $account->password)) { + header('Location: /sign-in?error=3'); +} else { + session_start(); + $_SESSION['account'] = $account; + //header('Location: /accueil'); +} diff --git a/src/app/controllers/sign-up.php b/src/app/controllers/sign-up.php new file mode 100644 index 0000000..836e12f --- /dev/null +++ b/src/app/controllers/sign-up.php @@ -0,0 +1,25 @@ +prepare('INSERT INTO account (first_name, last_name, phone, email, password, date_creation, role) VALUES (?, ?, ?, ?, ?, ?, ?)'); +$query->execute([$first_name, $last_name, $phone, $email, password_hash($password, PASSWORD_DEFAULT), date("Y-m-d"), 1]); + +header('Location: /sign-in'); \ No newline at end of file diff --git a/src/app/models/account.php b/src/app/models/account.php new file mode 100644 index 0000000..fa43067 --- /dev/null +++ b/src/app/models/account.php @@ -0,0 +1,15 @@ + diff --git a/src/app/views/404.php b/src/app/views/404.php new file mode 100644 index 0000000..2bc380d --- /dev/null +++ b/src/app/views/404.php @@ -0,0 +1,8 @@ + +
Page not found
+= $account->first_name ?>
+= $account->last_name ?>
+= $account->email ?>
+= $account->phone ?>
+= $account->date_creation ?>
+Découvrez nos plats savoureux !
+ + +mettre horaire, photos, etc...
+ + diff --git a/src/app/views/partials/footer.php b/src/app/views/partials/footer.php new file mode 100644 index 0000000..691287b --- /dev/null +++ b/src/app/views/partials/footer.php @@ -0,0 +1,2 @@ +