diff --git a/db/datahandler.php b/db/datahandler.php index a6f9d5c..2ae0b56 100644 --- a/db/datahandler.php +++ b/db/datahandler.php @@ -6,7 +6,7 @@ class DataHandler { public function registerUser($data) { - $username = testinput($data->username); + $username = testinput($data->email); $password = testinput($data->password); $email = testinput($data->email); $phone = testinput($data->phone); @@ -17,12 +17,13 @@ class DataHandler $streetnumber = testinput($data->streetnumber); $postalcode = testinput($data->postalcode); $country = testinput($data->country); + $role = "customer"; $password = password_hash($password, PASSWORD_DEFAULT); require($_SERVER['DOCUMENT_ROOT'] . '/config/setupDBAccess.php'); - $sql = "INSERT INTO user (username, password, email, phone, salutation, firstname, lastname) VALUES (?,?,?,?,?,?,?)"; + $sql = "INSERT INTO `user` (`user_id`, `username`, `password`, `email`, `phone`, `salutation`, `firstname`, `lastname`, `role`, `created_at`) VALUES (?,?,?,?,?,?,?,?,?,?)"; $sql2 = "INSERT IGNORE INTO cities (postalcode, name) VALUES (?,?)"; $sql3 = "INSERT INTO address (street, streetnumber, postalcode, country) VALUES (?,?,?,?)"; @@ -30,7 +31,7 @@ class DataHandler $stmtCities = $db->prepare($sql2); $stmtAddress = $db->prepare($sql3); - $stmtUser->bind_param("sssssss", $username, $password, $email, $phone, $salutation, $firstname, $lastname); + $stmtUser->bind_param("ssssssssss",null, $username, $password, $email, $phone, $salutation, $firstname, $lastname, $role, null); $stmtCities->bind_param("ss", $postalcode, $country); $stmtAddress->bind_param("ssss", $street, $streetnumber, $postalcode, $country); diff --git a/logic/test.php b/logic/test.php deleted file mode 100644 index e69de29..0000000 diff --git a/models/class.php b/models/class.php deleted file mode 100644 index e69de29..0000000