From b93e0c8e5aa9fa4f0f9b7b846aec6e3469e48810 Mon Sep 17 00:00:00 2001 From: Simon Date: Wed, 18 Jan 2023 09:51:43 +0100 Subject: [PATCH] change: signup --- index.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/index.php b/index.php index 374358d..b742cb0 100644 --- a/index.php +++ b/index.php @@ -34,7 +34,12 @@ $app->get("/user/:id", function (array $req, Response $res) use ($db) { $res->send("user " . $req["params"]["id"]); }); $app->post("/createuser", function (array $req, Response $res) use ($db) { - $db->insert("utente", ["email" => "test@email.com", "parolaDordine" => "password", "nomeUtente" => "testuser"]); + $newUsername = $req["body"]["username"]; + $newPassword = $req["body"]["password"]; + $newEmail = $req["body"]["email"]; + // $db->insert("utente", ["email" => "test@email.com", "parolaDordine" => "password", "nomeUtente" => "testuser"]); + $db->insert("utente", ["email" => "$newEmail", "parolaDordine" => "$newPassword", "nomeUtente" => "$newUsername"]); + $res->send("user "); });