From 53dd39f0654c5d9735068c9ff1883c17b4dbf9f1 Mon Sep 17 00:00:00 2001 From: Joshua Perry <45966243+jpez-development@users.noreply.github.com> Date: Wed, 2 Nov 2022 15:39:55 +0000 Subject: [PATCH] register page created an linked to db --- layout.php | 31 ++++++++++++++++++++---------- public/account/login.php | 32 +++++++++++++++++++++++++++++++ public/account/register.php | 38 +++++++++++++++++++++++++++++++++++++ 3 files changed, 91 insertions(+), 10 deletions(-) diff --git a/layout.php b/layout.php index 7917cb1..a1ff871 100644 --- a/layout.php +++ b/layout.php @@ -1,3 +1,13 @@ +Logout'; +} +else { + $logButton = 'href="account/login.php">Login'; +} +?> +
@@ -6,29 +16,30 @@ echo $pageTitle ?> - +
diff --git a/public/account/login.php b/public/account/login.php
index e69de29..8afbb39 100644
--- a/public/account/login.php
+++ b/public/account/login.php
@@ -0,0 +1,32 @@
+Don\'t have an account?Click here to register
+ Successful login
'; + } + else { + echo 'Unsuccessful Login
'; + } +} +?> \ No newline at end of file diff --git a/public/account/register.php b/public/account/register.php index e69de29..6e35b28 100644 --- a/public/account/register.php +++ b/public/account/register.php @@ -0,0 +1,38 @@ +prepare('INSERT INTO users (first_name, last_name, email, password) + VALUES (:first_name, :last_name, :email, :password)'); + $values = [ + 'first_name' => $_POST['first_name'], + 'last_name' => $_POST['last_name'], + 'email' => $_POST['email'], + 'password' => password_hash($_POST['password'], PASSWORD_DEFAULT) + ]; + $stmt->execute($values); +} + +$pageTitle = 'iBuy - Register'; +$pageContent = 'Already have an account?Click here to Login
+Successful account creation
'; +} +?> \ No newline at end of file