Login #1

Merged
PBS2H21ASH merged 15 commits from feat/login into don 2023-01-18 08:40:26 +01:00
2 changed files with 5 additions and 4 deletions
Showing only changes of commit 2860a01cf8 - Show all commits

View File

@ -120,6 +120,7 @@ class BancaDati {
try { try {
return $this->pdo->query($sql)->fetch(); return $this->pdo->query($sql)->fetch();
}catch (PDOException $e){ }catch (PDOException $e){
var_dump($e);
die; die;
} }
} }

View File

@ -14,16 +14,16 @@ $db = new BancaDati();
$app->use("/", function (array &$req, Response $res) { $app->use("/", function (array &$req, Response $res) {
if(isset($_COOKIE["TOKEN"])){ if(isset($_COOKIE["TOKEN"])){
// user mit token finden und im req übergeben
$user = new User(); $user = new User();
$user->loginWithToken($_COOKIE["TOKEN"]); if($user->loginWithToken($_COOKIE["TOKEN"])){
$req["user"] = $user; $req["user"] = $user;
}
} }
}); });
$app->get("/", function (array $req, Response $res) { $app->get("/", function (array $req, Response $res) {
$res->send("Hello World"); $res->send("Hello World");
var_dump($req["user"]); //var_dump($req["user"]);
}); });
$app->get("/user", function (array $req, Response $res) { $app->get("/user", function (array $req, Response $res) {