From cefac0c252fb9d00a96284f9ebbdbccd499a0408 Mon Sep 17 00:00:00 2001 From: StockiP Date: Fri, 29 Apr 2022 16:49:07 +0200 Subject: [PATCH] added stuff in pair programming session --- components/registerModal.html | 12 +++++---- config/dbaccess.php | 8 ++++++ config/setupDBAccess.php | 9 +++++++ db/datahandler.php | 48 +++++++++++++++++++++++++++++++++++ index.html | 1 + js/app.js | 11 ++++++++ js/registration.js | 28 ++++++++++++++++++++ logic/testinput.php | 10 ++++++++ logic/userLogic.php | 45 ++++++++++++++++++++++++++++++++ models/user.class.php | 23 +++++++++-------- 10 files changed, 179 insertions(+), 16 deletions(-) create mode 100644 config/dbaccess.php create mode 100644 config/setupDBAccess.php create mode 100644 db/datahandler.php create mode 100644 js/app.js create mode 100644 js/registration.js create mode 100644 logic/testinput.php create mode 100644 logic/userLogic.php diff --git a/components/registerModal.html b/components/registerModal.html index 35ae085..69ae984 100644 --- a/components/registerModal.html +++ b/components/registerModal.html @@ -5,13 +5,14 @@ - \ No newline at end of file + + \ No newline at end of file diff --git a/config/dbaccess.php b/config/dbaccess.php new file mode 100644 index 0000000..f5df6fa --- /dev/null +++ b/config/dbaccess.php @@ -0,0 +1,8 @@ + \ No newline at end of file diff --git a/config/setupDBAccess.php b/config/setupDBAccess.php new file mode 100644 index 0000000..228fdb1 --- /dev/null +++ b/config/setupDBAccess.php @@ -0,0 +1,9 @@ +connect_errno) { + echo "Failed to connect to MySQL: (" . $db->connect_errno . ") " . $db->connect_error; + } + +?> \ No newline at end of file diff --git a/db/datahandler.php b/db/datahandler.php new file mode 100644 index 0000000..ffd6fac --- /dev/null +++ b/db/datahandler.php @@ -0,0 +1,48 @@ +prepare($sql); + $stmtCities = $db->prepare($sql2); + $stmtAddress = $db->prepare($sql3); + + $stmtUser->bind_param("sssssss", $username, $password, $email, $phone, $salutation, $firstname, $lastname); + $stmtCities->bind_param("ss", $postalcode, $country); + $stmtAddress->bind_param("ssss", $street, $streetnumber, $postalcode, $country); + + if ($stmtUser->execute() && $stmtCities->execute() && $stmtAddress->execute()) { + return true; + } else { + return false; + } + $stmtUser->close(); + $stmtCities->close(); + $stmtAddress->close(); + $db->close(); + + } +} +?> \ No newline at end of file diff --git a/index.html b/index.html index 6171cf4..9a2dd52 100644 --- a/index.html +++ b/index.html @@ -66,6 +66,7 @@ +