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 @@ + +
+
+

404

+

Page not found

+
+
+ diff --git a/src/app/views/account_view.php b/src/app/views/account_view.php new file mode 100644 index 0000000..f568932 --- /dev/null +++ b/src/app/views/account_view.php @@ -0,0 +1,30 @@ + + + +
+

Mon compte

+
+
+ +

first_name ?>

+
+
+ +

last_name ?>

+
+
+ +

email ?>

+
+
+ +

phone ?>

+
+
+ +

date_creation ?>

+
+
+
+ + diff --git a/src/app/views/home.php b/src/app/views/home.php new file mode 100644 index 0000000..91f921b --- /dev/null +++ b/src/app/views/home.php @@ -0,0 +1,11 @@ + + +

Bienvenue a EFES KEBAB

+ +
Home page
+

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 @@ + + \ No newline at end of file diff --git a/src/app/views/partials/header.php b/src/app/views/partials/header.php new file mode 100644 index 0000000..9dc865c --- /dev/null +++ b/src/app/views/partials/header.php @@ -0,0 +1,9 @@ + + + + + <?php echo isset($title) ? $title : "EFES KEBAB"; ?> + + diff --git a/src/app/views/partials/nav.php b/src/app/views/partials/nav.php new file mode 100644 index 0000000..a72ca70 --- /dev/null +++ b/src/app/views/partials/nav.php @@ -0,0 +1,14 @@ + + diff --git a/src/app/views/partials/navbar.php b/src/app/views/partials/navbar.php new file mode 100644 index 0000000..9f5685f --- /dev/null +++ b/src/app/views/partials/navbar.php @@ -0,0 +1,25 @@ + + + \ No newline at end of file diff --git a/src/app/views/sign-in.php b/src/app/views/sign-in.php new file mode 100644 index 0000000..1677096 --- /dev/null +++ b/src/app/views/sign-in.php @@ -0,0 +1,16 @@ + +
+

Sign in

+
+
+ + +
+
+ + +
+ +
+
+ diff --git a/src/app/views/sign-up.php b/src/app/views/sign-up.php new file mode 100644 index 0000000..db1c55f --- /dev/null +++ b/src/app/views/sign-up.php @@ -0,0 +1,35 @@ + +
+

Sign up

+
+
+
+ + +
+
+ + +
+
+
+ + + +
+
+ + +
+
+ + +
+
+ + +
+ +
+
+ diff --git a/src/routes/web.php b/src/routes/web.php index 3469b71..f85cad4 100644 --- a/src/routes/web.php +++ b/src/routes/web.php @@ -1,9 +1,10 @@ [ - '/' => ['TestController', 'test'], - '/test' => ['TestController', 'test'], - '/test2' => ['TestController', 'test2'], + '/' => ['HomeController', 'home'], + '/sign-in' => ['HomeController', 'viewSignIn'], + '/sign-up' => ['HomeController', 'viewSignUp'], + '/account' => ['HomeController', 'viewAccount'], ], 'POST' => [